Removidos arquivos inúteis
This commit is contained in:
parent
ed1ae6f2c9
commit
7e72f6f20f
@ -1,48 +0,0 @@
|
||||
import sequelize from "sequelize";
|
||||
import database from "../../database";
|
||||
import { hash } from "bcryptjs";
|
||||
|
||||
const ResetPassword = async (email: string ,token: string, password: string) => {
|
||||
|
||||
const {hasResult , data} = await filterUser(email, token);
|
||||
|
||||
if (!hasResult) {
|
||||
return { status: 404, message: "Email não encontrado" };
|
||||
}
|
||||
|
||||
if(hasResult === true){
|
||||
try{
|
||||
const convertPassword: string= await hash(password,8)
|
||||
|
||||
const {hasResults , datas} = await insertHasPassword(email, token ,convertPassword);
|
||||
|
||||
if (datas.length === 0){
|
||||
return { status: 404, message: "Token não encontrado" };
|
||||
}
|
||||
|
||||
}catch(err){
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
export default ResetPassword;
|
||||
|
||||
const filterUser = async (email : string , token: string)=>{
|
||||
const sql = `SELECT * FROM "Users" WHERE email = '${email}' AND "resetPassword" != ''`;
|
||||
const result = await database.query(sql, { type: sequelize.QueryTypes.SELECT });
|
||||
return { hasResult: result.length > 0, data: result };
|
||||
}
|
||||
const insertHasPassword = async (email : string , token: string, convertPassword: string)=>{
|
||||
|
||||
|
||||
const sqlValida = `SELECT * FROM "Users" WHERE email = '${email}' AND "resetPassword" = '${token}'`;
|
||||
const resultado = await database.query(sqlValida, { type: sequelize.QueryTypes.SELECT });
|
||||
|
||||
|
||||
const sqls = `UPDATE "Users" SET "passwordHash"= '${convertPassword}' , "resetPassword" = '' WHERE email= '${email}' AND "resetPassword" = '${token}'`;
|
||||
const results = await database.query(sqls, { type: sequelize.QueryTypes.UPDATE });
|
||||
|
||||
|
||||
return { hasResults: results.length > 0, datas: resultado};
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
{
|
||||
"short_name": "Whaticket_Saas",
|
||||
"name": "Whaticket_Saas",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user