Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: admin password reset should not timeout

Andras Bacsaib735ca2da7ff
diff --git a/apps/api/src/routes/api/v1/handlers.ts b/apps/api/src/routes/api/v1/handlers.ts
index 95988f1f12..c761812940 100644
--- a/apps/api/src/routes/api/v1/handlers.ts
+++ b/apps/api/src/routes/api/v1/handlers.ts
@@ -157,10 +157,18 @@ export async function login(request: FastifyRequest<Login>, reply: FastifyReply)
if (userFound.password === 'RESETME') {
const hashedPassword = await hashPassword(password);
if (userFound.updatedAt < new Date(Date.now() - 1000 * 60 * 10)) {
- await prisma.user.update({
- where: { email: userFound.email },
- data: { password: 'RESETTIMEOUT' }
- });
+ if (userFound.id === '0') {
+ await prisma.user.update({
+ where: { email: userFound.email },
+ data: { password: 'RESETME' }
+ });
+ } else {
+ await prisma.user.update({
+ where: { email: userFound.email },
+ data: { password: 'RESETTIMEOUT' }
+ });
+ }
+
throw {
status: 500,
message: 'Password reset link has expired. Please request a new one.'