From 75080cfe3055d214ac29d14e5b50760ebb49082b Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 25 May 2017 16:19:19 -0300 Subject: [PATCH] Password reset and valid locations --- client/coral-admin/src/actions/auth.js | 7 +++++-- services/users.js | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/coral-admin/src/actions/auth.js b/client/coral-admin/src/actions/auth.js index 29971e294..2eb85c86a 100644 --- a/client/coral-admin/src/actions/auth.js +++ b/client/coral-admin/src/actions/auth.js @@ -1,6 +1,7 @@ +import {pym} from 'coral-framework'; import * as actions from '../constants/auth'; -import * as Storage from 'coral-framework/helpers/storage'; import coralApi from 'coral-framework/helpers/response'; +import * as Storage from 'coral-framework/helpers/storage'; import {handleAuthToken} from 'coral-framework/actions/auth'; //============================================================================== @@ -52,7 +53,9 @@ const forgotPassowordFailure = () => ({ export const requestPasswordReset = (email) => (dispatch) => { dispatch(forgotPassowordRequest(email)); - return coralApi('/account/password/reset', {method: 'POST', body: {email}}) + const redirectUri = location.href; + + return coralApi('/account/password/reset', {method: 'POST', body: {email, loc: redirectUri}}) .then(() => dispatch(forgotPassowordSuccess())) .catch((error) => dispatch(forgotPassowordFailure(error))); }; diff --git a/services/users.js b/services/users.js index 496db4528..07a690411 100644 --- a/services/users.js +++ b/services/users.js @@ -566,10 +566,9 @@ module.exports = class UsersService { // endpoint. return; } - let redirectDomain; try { - redirectDomain = url.parse(loc).hostname; + redirectDomain = url.parse(loc).host; } catch (e) { return Promise.reject('redirect location is invalid'); }