fix: admin password reset should not timeout
This commit is contained in:
parent
cbdd098528
commit
b735ca2da7
@ -157,10 +157,18 @@ export async function login(request: FastifyRequest<Login>, reply: FastifyReply)
|
|||||||
if (userFound.password === 'RESETME') {
|
if (userFound.password === 'RESETME') {
|
||||||
const hashedPassword = await hashPassword(password);
|
const hashedPassword = await hashPassword(password);
|
||||||
if (userFound.updatedAt < new Date(Date.now() - 1000 * 60 * 10)) {
|
if (userFound.updatedAt < new Date(Date.now() - 1000 * 60 * 10)) {
|
||||||
|
if (userFound.id === '0') {
|
||||||
|
await prisma.user.update({
|
||||||
|
where: { email: userFound.email },
|
||||||
|
data: { password: 'RESETME' }
|
||||||
|
});
|
||||||
|
} else {
|
||||||
await prisma.user.update({
|
await prisma.user.update({
|
||||||
where: { email: userFound.email },
|
where: { email: userFound.email },
|
||||||
data: { password: 'RESETTIMEOUT' }
|
data: { password: 'RESETTIMEOUT' }
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
throw {
|
throw {
|
||||||
status: 500,
|
status: 500,
|
||||||
message: 'Password reset link has expired. Please request a new one.'
|
message: 'Password reset link has expired. Please request a new one.'
|
||||||
|
Loading…
Reference in New Issue
Block a user