RegistrationForm: Handle email confirmation, fixes #137
This commit is contained in:
parent
e120b56e8f
commit
d295368170
1 changed files with 4 additions and 1 deletions
|
@ -128,13 +128,16 @@ export function logOut() {
|
|||
|
||||
export function register(params) {
|
||||
return (dispatch, getState) => {
|
||||
const needsConfirmation = getState().getIn(['instance', 'pleroma', 'metadata', 'account_activation_required']);
|
||||
dispatch({ type: AUTH_REGISTER_REQUEST });
|
||||
return dispatch(createAppAndToken()).then(() => {
|
||||
return api(getState, 'app').post('/api/v1/accounts', params);
|
||||
}).then(response => {
|
||||
dispatch({ type: AUTH_REGISTER_SUCCESS, token: response.data });
|
||||
dispatch(authLoggedIn(response.data));
|
||||
return dispatch(fetchMe());
|
||||
return needsConfirmation
|
||||
? dispatch(showAlert('', 'Check your email for further instructions.'))
|
||||
: dispatch(fetchMe());
|
||||
}).catch(error => {
|
||||
dispatch({ type: AUTH_REGISTER_FAIL, error });
|
||||
throw error;
|
||||
|
|
Loading…
Reference in a new issue