mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-16 06:39:43 -06:00
Reset password returns a token
This commit is contained in:
@@ -309,11 +309,11 @@ const validateRecoveryTokenController = async (req, res, next) => {
|
||||
const resetPasswordController = async (req, res, next) => {
|
||||
try {
|
||||
await newPasswordValidation.validateAsync(req.body);
|
||||
user = await req.db.resetPassword(req, res);
|
||||
const token = await req.db.resetPassword(req, res);
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
msg: successMessages.AUTH_RESET_PASSWORD,
|
||||
data: user,
|
||||
data: token,
|
||||
});
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
|
||||
@@ -220,7 +220,8 @@ const resetPassword = async (req, res) => {
|
||||
})
|
||||
.select("-password")
|
||||
.select("-profileImage");
|
||||
return userWithoutPassword;
|
||||
const token = issueToken(userWithoutPassword);
|
||||
return token;
|
||||
} else {
|
||||
throw new Error(errorMessages.DB_USER_NOT_FOUND);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user