From 82f952608c1dd565cf90bd58859859dfae730e3b Mon Sep 17 00:00:00 2001 From: mrjvs Date: Wed, 12 Aug 2026 17:45:57 +0200 Subject: [PATCH] fix: fix password resets by using HTTP API --- server/api/auth/reset-password.post.ts | 17 ++++-- src/pages/account/forgot-password.vue | 79 ++++++++++++++++++++++++- src/pages/account/register.vue | 14 ++--- src/pages/account/reset-password.vue | 80 ++++++++++++++++++++++++++ 4 files changed, 177 insertions(+), 13 deletions(-) create mode 100644 src/pages/account/reset-password.vue diff --git a/server/api/auth/reset-password.post.ts b/server/api/auth/reset-password.post.ts index ea38587..ea77ebd 100644 --- a/server/api/auth/reset-password.post.ts +++ b/server/api/auth/reset-password.post.ts @@ -2,11 +2,18 @@ import { ResetPasswordSchema } from '~~/shared/api-types'; export default defineEventHandler(async (event): Promise => { const body = await readZodBody(event, ResetPasswordSchema); - const grpc = useApiGrpc(event); + const apiFetch = useHttpApi(event); - await grpc.resetPassword({ - password: body.password, - passwordConfirm: body.passwordConfirm, - token: body.resetToken + // The GRPC version requires a login token, which the user doesnt have when resetting password, so we're using the HTTP api + await apiFetch('/v1/reset-password', { + method: 'POST', + body: JSON.stringify({ + password: body.password, + password_confirm: body.passwordConfirm, + token: body.resetToken + }), + headers: { + 'Content-type': 'application/json' + } }); }); diff --git a/src/pages/account/forgot-password.vue b/src/pages/account/forgot-password.vue index 3021bc0..4dd0d3b 100644 --- a/src/pages/account/forgot-password.vue +++ b/src/pages/account/forgot-password.vue @@ -1,5 +1,82 @@ + + + + diff --git a/src/pages/account/register.vue b/src/pages/account/register.vue index a625833..eff01a6 100644 --- a/src/pages/account/register.vue +++ b/src/pages/account/register.vue @@ -115,6 +115,13 @@ async function registerSubmission() { required > +
-