mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-26 23:10:20 +05:30
#245: disable account switcher after user logged to new account during oauth (ignore prompt=slect_account)
This commit is contained in:
parent
c33f13e49a
commit
a4fd1314c2
@ -19,12 +19,16 @@ export default class PasswordState extends AbstractState {
|
||||
resolve(context, {password, rememberMe}) {
|
||||
const {auth: {login}} = context.getState();
|
||||
|
||||
context.run('login', {
|
||||
return context.run('login', {
|
||||
password,
|
||||
rememberMe,
|
||||
login
|
||||
})
|
||||
.then(() => context.setState(new CompleteState()))
|
||||
.then(() => {
|
||||
context.run('setAccountSwitcher', false);
|
||||
|
||||
context.setState(new CompleteState());
|
||||
})
|
||||
.catch((err = {}) => err.errors || logger.warn(err));
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import expect from 'unexpected';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import PasswordState from 'services/authFlow/PasswordState';
|
||||
@ -60,6 +61,7 @@ describe('PasswordState', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expectRun(mock, 'setAccountSwitcher', false);
|
||||
expectRun(
|
||||
mock,
|
||||
'login',
|
||||
@ -69,27 +71,11 @@ describe('PasswordState', () => {
|
||||
rememberMe: expectedRememberMe,
|
||||
})
|
||||
).returns(Promise.resolve());
|
||||
|
||||
state.resolve(context, {password: expectedPassword, rememberMe: expectedRememberMe});
|
||||
});
|
||||
|
||||
it('should transition to complete state on successfull login', () => {
|
||||
const promise = Promise.resolve();
|
||||
const expectedLogin = 'login';
|
||||
const expectedPassword = 'password';
|
||||
|
||||
context.getState.returns({
|
||||
auth: {
|
||||
login: expectedLogin
|
||||
}
|
||||
});
|
||||
|
||||
mock.expects('run').returns(promise);
|
||||
expectState(mock, CompleteState);
|
||||
|
||||
state.resolve(context, {password: expectedPassword});
|
||||
const payload = {password: expectedPassword, rememberMe: expectedRememberMe};
|
||||
|
||||
return promise;
|
||||
return expect(state.resolve(context, payload), 'to be fulfilled');
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user