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