mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#48: add/remove accounts from account switcher. Allow authorized users to log in into another account
This commit is contained in:
@@ -5,9 +5,9 @@ import LoginState from './LoginState';
|
||||
|
||||
export default class PasswordState extends AbstractState {
|
||||
enter(context) {
|
||||
const {user} = context.getState();
|
||||
const {auth} = context.getState();
|
||||
|
||||
if (user.isGuest) {
|
||||
if (auth.login) {
|
||||
context.navigate('/password');
|
||||
} else {
|
||||
context.setState(new CompleteState());
|
||||
@@ -15,12 +15,12 @@ export default class PasswordState extends AbstractState {
|
||||
}
|
||||
|
||||
resolve(context, {password, rememberMe}) {
|
||||
const {user} = context.getState();
|
||||
const {auth: {login}} = context.getState();
|
||||
|
||||
context.run('login', {
|
||||
password,
|
||||
rememberMe,
|
||||
login: user.email || user.username
|
||||
login
|
||||
})
|
||||
.then(() => context.setState(new CompleteState()));
|
||||
}
|
||||
@@ -30,7 +30,7 @@ export default class PasswordState extends AbstractState {
|
||||
}
|
||||
|
||||
goBack(context) {
|
||||
context.run('logout');
|
||||
context.run('setLogin', null);
|
||||
context.setState(new LoginState());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user