migration to postgres
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ export const changePasswordHandler: Handler = async function (ctx) {
|
||||
if (isProduction) validatePassword(newPassword);
|
||||
const reqUser = ctx.get('user');
|
||||
|
||||
const dbUser = getUserById(reqUser.id);
|
||||
const dbUser = await getUserById(reqUser.id);
|
||||
|
||||
if (!dbUser) throw errors.UNAUTHORIZED();
|
||||
|
||||
@@ -23,8 +23,7 @@ export const changePasswordHandler: Handler = async function (ctx) {
|
||||
}
|
||||
|
||||
const newPasswordHash = await argon2.hash(newPassword);
|
||||
// Use floored seconds-to-ms so the token iat (also floored) is never behind
|
||||
const passwordChangedAt = Math.floor(Date.now() / 1000) * 1000;
|
||||
const passwordChangedAt = new Date();
|
||||
await updateUser(reqUser.id, { password: newPasswordHash, passwordChangedAt });
|
||||
|
||||
const { id, email, name, role } = reqUser;
|
||||
|
||||
Reference in New Issue
Block a user