Unverified Commit 1451334e authored by Christopher Speller's avatar Christopher Speller Committed by GitHub
Browse files

Allowing empty submission of MFA for hardened mode. (#1271)

parent 3fe8cfba
......@@ -52,12 +52,6 @@ export default class LoginMfa extends React.PureComponent {
e.preventDefault();
const state = {};
if (!this.state.token) {
state.serverError = localizeMessage('login_mfa.tokenReq', 'Please enter an MFA token');
this.setState(state);
return;
}
state.serverError = '';
state.saving = true;
this.setState(state);
......
......@@ -41,9 +41,10 @@ describe('components/login/LoginMfa', () => {
wrapper.setState({token: '', serverError: '', saving: false});
wrapper.instance().handleSubmit({preventDefault: jest.fn()});
expect(wrapper.state('serverError')).toEqual('Please enter an MFA token');
expect(wrapper.state('saving')).toEqual(false);
expect(submit).not.toBeCalled();
expect(wrapper.state('serverError')).toEqual('');
expect(wrapper.state('saving')).toEqual(true);
expect(submit).toBeCalled(); // This is not a bug. See https://github.com/mattermost/mattermost-server/pull/8881
expect(submit).toBeCalledWith(props.loginId, props.password, '');
wrapper.setState({token: '123456', serverError: ''});
wrapper.instance().handleSubmit({preventDefault: jest.fn()});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment