From 17bdf52496ddded331ba244e63bb42e909e5380a Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sun, 28 Feb 2016 13:24:47 +0200 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B0=D0=BA=D0=BA=D0=B0?= =?UTF-8?q?=D1=83=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/PasswordChange.jsx | 5 +++-- src/components/auth/actions.js | 10 +++++++++- src/components/user/User.js | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) 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 };