mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-16 02:08:59 +05:30
Обработка ошибки не активированного аккаунта
This commit is contained in:
parent
bef0910bc3
commit
17bdf52496
@ -2,6 +2,7 @@ import React, { PropTypes } from 'react';
|
||||
|
||||
import { FormattedMessage as Message } from 'react-intl';
|
||||
import Helmet from 'react-helmet';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
import buttons from 'components/ui/buttons.scss';
|
||||
import { Input } from 'components/ui/Form';
|
||||
@ -75,9 +76,9 @@ export default function PasswordChange() {
|
||||
</button>
|
||||
),
|
||||
Links: () => (
|
||||
<a href="/oauth/permissions">
|
||||
<Link to="/oauth/permissions">
|
||||
<Message {...passwordChangedMessages.skipThisStep} />
|
||||
</a>
|
||||
</Link>
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import request from 'services/request';
|
||||
export function login({login = '', password = '', rememberMe = false}) {
|
||||
const PASSWORD_REQUIRED = 'error.password_required';
|
||||
const LOGIN_REQUIRED = 'error.login_required';
|
||||
const ACTIVATION_REQUIRED = 'error.account_not_activated';
|
||||
|
||||
return (dispatch) =>
|
||||
request.post(
|
||||
@ -23,7 +24,14 @@ export function login({login = '', password = '', rememberMe = false}) {
|
||||
dispatch(redirectToGoal());
|
||||
})
|
||||
.catch((resp) => {
|
||||
if (resp.errors.password === PASSWORD_REQUIRED) {
|
||||
if (resp.errors.login === ACTIVATION_REQUIRED) {
|
||||
dispatch(updateUser({
|
||||
isActive: false,
|
||||
isGuest: false
|
||||
}));
|
||||
|
||||
dispatch(redirectToGoal());
|
||||
} else if (resp.errors.password === PASSWORD_REQUIRED) {
|
||||
dispatch(updateUser({
|
||||
username: login,
|
||||
email: login
|
||||
|
@ -23,7 +23,7 @@ export default class User {
|
||||
avatar: '',
|
||||
goal: null, // the goal with wich user entered site
|
||||
isGuest: true,
|
||||
isActive: false,
|
||||
isActive: true,
|
||||
shouldChangePassword: false
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user