Added route for validating recovery token
This commit is contained in:
1 parent
276dadab66
commit
0eda4ceb77
3 files changed
+36
-2
No files matched your search
@@ -112,6 +112,20 @@ const requestRecoveryToken = async (req, res) => {
|
||||
}
|
||||
};
|
||||
|
||||
const validateRecoveryToken = async (req, res) => {
|
||||
try {
|
||||
const candidateToken = req.body.recoveryToken;
|
||||
const recoveryToken = await RecoveyToken.findOne({ token: candidateToken });
|
||||
if (recoveryToken !== null) {
|
||||
return recoveryToken;
|
||||
} else {
|
||||
throw new Error("Token not found");
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
//****************************************
|
||||
// Monitors
|
||||
//****************************************
|
||||
@@ -420,6 +434,7 @@ module.exports = {
|
||||
getUserByEmail,
|
||||
updateUser,
|
||||
requestRecoveryToken,
|
||||
validateRecoveryToken,
|
||||
getAllMonitors,
|
||||
getMonitorById,
|
||||
getMonitorsByUserId,
|
||||
|
||||
Reference in new issue
Block a user