password reset
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Restaurant from "../models/restaurant.js";
|
||||
import {} from "./dataPrepServices.js";
|
||||
import crypto from "crypto";
|
||||
import Dish from "../models/dish.js";
|
||||
import User from "../models/users.js";
|
||||
import mongoose from "mongoose";
|
||||
@@ -59,6 +59,22 @@ export function generateAuthToken(user) {
|
||||
return token;
|
||||
}
|
||||
|
||||
function generatePasswordResetToken(email) {
|
||||
const token = jwt.sign(
|
||||
{
|
||||
email: email,
|
||||
},
|
||||
jwtSecret,
|
||||
{ expiresIn: "15m" }
|
||||
);
|
||||
return token;
|
||||
}
|
||||
|
||||
export function generatePasswordResetLink(email) {
|
||||
const token = generatePasswordResetToken(email);
|
||||
const link = `htt`;
|
||||
}
|
||||
|
||||
export async function checkEmailTaken(email) {
|
||||
if (!email) throw newError("No input email", 204);
|
||||
await User.exists({ email: email }).then((res) => {
|
||||
|
||||
Reference in New Issue
Block a user