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