mirror of
https://github.com/wassname/talk.git
synced 2026-08-09 12:30:42 +08:00
Password reset and valid locations
This commit is contained in:
@@ -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)));
|
||||
};
|
||||
|
||||
+1
-2
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user