Merge pull request #354 from bluewave-labs/feat/add-user-to-reset-password-return
Add user to response
This commit is contained in:
2 files changed
+3
-3
No files matched your search
@@ -309,11 +309,11 @@ const validateRecoveryTokenController = async (req, res, next) => {
|
|||||||
const resetPasswordController = async (req, res, next) => {
|
const resetPasswordController = async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
await newPasswordValidation.validateAsync(req.body);
|
await newPasswordValidation.validateAsync(req.body);
|
||||||
const token = await req.db.resetPassword(req, res);
|
const response = await req.db.resetPassword(req, res);
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
msg: successMessages.AUTH_RESET_PASSWORD,
|
msg: successMessages.AUTH_RESET_PASSWORD,
|
||||||
data: token,
|
data: response,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
error.service = SERVICE_NAME;
|
error.service = SERVICE_NAME;
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ const resetPassword = async (req, res) => {
|
|||||||
.select("-password")
|
.select("-password")
|
||||||
.select("-profileImage");
|
.select("-profileImage");
|
||||||
const token = issueToken(userWithoutPassword);
|
const token = issueToken(userWithoutPassword);
|
||||||
return token;
|
return { user: userWithoutPassword, token: token };
|
||||||
} else {
|
} else {
|
||||||
throw new Error(errorMessages.DB_USER_NOT_FOUND);
|
throw new Error(errorMessages.DB_USER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user