From 5362c4aba5f18df0cdd7799c9f41256c107cd203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=A4lbich?= Date: Sun, 20 Oct 2019 10:47:55 +0200 Subject: [PATCH] Add the websiteId to the storeViews and use it when calling reset-password --- config/default.json | 2 ++ src/api/user.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/default.json b/config/default.json index 586be40a..15aa788b 100644 --- a/config/default.json +++ b/config/default.json @@ -57,6 +57,7 @@ "storeCode": "de", "disabled": false, "storeId": 3, + "websiteId": 1, "name": "German Store", "url": "/de", "elasticsearch": { @@ -87,6 +88,7 @@ "storeCode": "it", "disabled": false, "storeId": 4, + "websiteId": 1, "name": "Italian Store", "url": "/it", "elasticsearch": { diff --git a/src/api/user.js b/src/api/user.js index af4b181a..2627c792 100755 --- a/src/api/user.js +++ b/src/api/user.js @@ -131,12 +131,14 @@ export default ({config, db}) => { */ userApi.post('/reset-password', (req, res) => { const userProxy = _getProxy(req) + const storeCode = req.query.storeCode + const websiteId = config.storeViews[storeCode].websiteId if(!req.body.email) { return apiStatus(res, "Invalid e-mail provided!", 500) } - userProxy.resetPassword({ email: req.body.email, template: "email_reset", websiteId: 1 }).then((result) => { + userProxy.resetPassword({ email: req.body.email, template: "email_reset", websiteId: websiteId }).then((result) => { apiStatus(res, result, 200); }).catch(err=> { apiError(res, err);