From 1a66987cd0ff298ff392ad27d43a81bed410eb14 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 13 Nov 2023 12:26:31 +0100 Subject: [PATCH] refs #5979 fix(vn-user): resetPassword url --- back/models/vn-user.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 970497e4e..712ed7d16 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -92,7 +92,11 @@ module.exports = function(Self) { }; Self.on('resetPasswordRequest', async function(info) { - const url = await Self.app.models.Url.getUrl(); + const loopBackContext = LoopBackContext.getCurrentContext(); + const httpCtx = {req: loopBackContext.active}; + const httpRequest = httpCtx.req.http.req; + const headers = httpRequest.headers; + const origin = headers.origin; const defaultHash = '/reset-password?access_token=$token$'; const recoverHashes = { @@ -108,7 +112,7 @@ module.exports = function(Self) { const params = { recipient: info.email, lang: user.lang, - url: url.slice(0, -1) + recoverHash + url: origin + '/#!' + recoverHash }; const options = Object.assign({}, info.options);