mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-30 10:42:34 +05:30
#48: add logout all link on choose account panel
This commit is contained in:
parent
13b4dcbbe8
commit
79a9efb561
@ -12,7 +12,7 @@
|
||||
"up": "npm update",
|
||||
"test": "karma start ./karma.conf.js",
|
||||
"lint": "eslint ./src",
|
||||
"i18n": "./node_modules/.bin/babel-node ./scripts/i18n-collect.js",
|
||||
"i18n": "babel-node ./scripts/i18n-collect.js",
|
||||
"build": "rm -rf dist/ && webpack --progress --colors -p"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { routeActions } from 'react-router-redux';
|
||||
|
||||
import { updateUser, logout as logoutUser, acceptRules as userAcceptRules } from 'components/user/actions';
|
||||
import { updateUser, logout, acceptRules as userAcceptRules } from 'components/user/actions';
|
||||
import { authenticate } from 'components/accounts/actions';
|
||||
import authentication from 'services/api/authentication';
|
||||
import oauth from 'services/api/oauth';
|
||||
@ -24,6 +24,7 @@ export function login({login = '', password = '', rememberMe = false}) {
|
||||
} else if (resp.errors.login === ACTIVATION_REQUIRED) {
|
||||
return dispatch(needActivation());
|
||||
} else if (resp.errors.login === LOGIN_REQUIRED && password) {
|
||||
// TODO: log this case to backend
|
||||
// return to the first step
|
||||
return dispatch(logout());
|
||||
}
|
||||
@ -143,9 +144,7 @@ export function clearErrors() {
|
||||
return setErrors(null);
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
return logoutUser();
|
||||
}
|
||||
export { logout, updateUser } from 'components/user/actions';
|
||||
|
||||
/**
|
||||
* @param {object} oauthData
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"chooseAccountTitle": "Choose an account",
|
||||
"addAccount": "Log into another account",
|
||||
"logoutAll": "Log out from all accounts",
|
||||
"description": "You have logged in into multiple accounts. Please choose the one, you want to use to authorize {appName}"
|
||||
}
|
||||
|
@ -7,5 +7,10 @@ export default factory({
|
||||
body: Body,
|
||||
footer: {
|
||||
label: messages.addAccount
|
||||
},
|
||||
links: [
|
||||
{
|
||||
label: messages.logoutAll
|
||||
}
|
||||
]
|
||||
});
|
||||
|
@ -21,6 +21,7 @@
|
||||
"components.auth.chooseAccount.addAccount": "Увайсці ў другі акаўнт",
|
||||
"components.auth.chooseAccount.chooseAccountTitle": "Выбар акаўнта",
|
||||
"components.auth.chooseAccount.description": "Вы выканалі ўваход у некалькі акаўнтаў. Пазначце, які вы жадаеце выкарыстаць для аўтарызацыі {appName}",
|
||||
"components.auth.chooseAccount.logoutAll": "Log out from all accounts",
|
||||
"components.auth.finish.authForAppFailed": "Аўтарызацыя для {appName} не атрымалася",
|
||||
"components.auth.finish.authForAppSuccessful": "Аўтарызацыя для {appName} паспяхова выканана",
|
||||
"components.auth.finish.copy": "Скапіяваць",
|
||||
|
@ -21,6 +21,7 @@
|
||||
"components.auth.chooseAccount.addAccount": "Log into another account",
|
||||
"components.auth.chooseAccount.chooseAccountTitle": "Choose an account",
|
||||
"components.auth.chooseAccount.description": "You have logged in into multiple accounts. Please choose the one, you want to use to authorize {appName}",
|
||||
"components.auth.chooseAccount.logoutAll": "Log out from all accounts",
|
||||
"components.auth.finish.authForAppFailed": "Authorization for {appName} was failed",
|
||||
"components.auth.finish.authForAppSuccessful": "Authorization for {appName} was successfully completed",
|
||||
"components.auth.finish.copy": "Copy",
|
||||
|
@ -21,6 +21,7 @@
|
||||
"components.auth.chooseAccount.addAccount": "Войти в другой аккаунт",
|
||||
"components.auth.chooseAccount.chooseAccountTitle": "Выбор аккаунта",
|
||||
"components.auth.chooseAccount.description": "Вы выполнили вход в несколько аккаунтов. Укажите, какой вы хотите использовать для авторизации {appName}",
|
||||
"components.auth.chooseAccount.logoutAll": "Выйти из всех аккаунтов",
|
||||
"components.auth.finish.authForAppFailed": "Авторизация для {appName} не удалась",
|
||||
"components.auth.finish.authForAppSuccessful": "Авторизация для {appName} успешно выполнена",
|
||||
"components.auth.finish.copy": "Скопировать",
|
||||
|
@ -21,6 +21,7 @@
|
||||
"components.auth.chooseAccount.addAccount": "Увійти в інший акаунт",
|
||||
"components.auth.chooseAccount.chooseAccountTitle": "Оберіть акаунт",
|
||||
"components.auth.chooseAccount.description": "Ви увійшли у декілька акаунтів. Будь ласка, оберіть акаунт, який ви бажаєте використовувати для авторизації {appName}",
|
||||
"components.auth.chooseAccount.logoutAll": "Вийти з усіх аккаунтів",
|
||||
"components.auth.finish.authForAppFailed": "Авторизація для {appName} не вдалася",
|
||||
"components.auth.finish.authForAppSuccessful": "Авторизація для {appName} успішно виконана",
|
||||
"components.auth.finish.copy": "Скопіювати",
|
||||
|
@ -17,4 +17,8 @@ export default class ChooseAccountState extends AbstractState {
|
||||
context.setState(new LoginState());
|
||||
}
|
||||
}
|
||||
|
||||
reject(context) {
|
||||
context.run('logout');
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
import AuthFlow from './AuthFlow';
|
||||
|
||||
import * as actions from 'components/auth/actions';
|
||||
import {updateUser} from 'components/user/actions';
|
||||
|
||||
const availableActions = {
|
||||
...actions,
|
||||
updateUser
|
||||
...actions
|
||||
};
|
||||
|
||||
export default new AuthFlow(availableActions);
|
||||
|
Loading…
Reference in New Issue
Block a user