diff --git a/src/components/auth/PasswordChange.jsx b/src/components/auth/PasswordChange.jsx index d886ccf..cb8302c 100644 --- a/src/components/auth/PasswordChange.jsx +++ b/src/components/auth/PasswordChange.jsx @@ -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() { ), Links: () => ( - + - + ) }; } diff --git a/src/components/auth/actions.js b/src/components/auth/actions.js index f477eda..f86f253 100644 --- a/src/components/auth/actions.js +++ b/src/components/auth/actions.js @@ -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 diff --git a/src/components/user/User.js b/src/components/user/User.js index 2239191..28fdeb0 100644 --- a/src/components/user/User.js +++ b/src/components/user/User.js @@ -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 };