mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
🔑 fix(AuthService): properly handle reading and deletion of password reset token (#3697)
This commit is contained in:
parent
cebb3751c1
commit
d4c0f7267a
1 changed files with 2 additions and 3 deletions
|
@ -280,9 +280,8 @@ const requestPasswordReset = async (req) => {
|
|||
* @returns
|
||||
*/
|
||||
const resetPassword = async (userId, token, password) => {
|
||||
let passwordResetToken = await createToken({
|
||||
let passwordResetToken = await findToken({
|
||||
userId,
|
||||
expiresIn: 900,
|
||||
});
|
||||
|
||||
if (!passwordResetToken) {
|
||||
|
@ -311,7 +310,7 @@ const resetPassword = async (userId, token, password) => {
|
|||
});
|
||||
}
|
||||
|
||||
await passwordResetToken.deleteOne();
|
||||
await deleteTokens({ token: passwordResetToken.token });
|
||||
logger.info(`[resetPassword] Password reset successful. [Email: ${user.email}]`);
|
||||
return { message: 'Password reset was successful' };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue