mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Always send password field during login
This commit is contained in:
@@ -186,14 +186,14 @@ describe('components/auth/actions', () => {
|
||||
(request.post as any).returns(
|
||||
Promise.reject({
|
||||
errors: {
|
||||
password: 'error.password_required',
|
||||
password: 'error.password_incorrect',
|
||||
},
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should set login', () =>
|
||||
callThunk(login, { login: 'foo' }).then(() => {
|
||||
callThunk(login, { login: 'foo', password: '' }).then(() => {
|
||||
expectDispatchCalls([[setLogin('foo')]]);
|
||||
}));
|
||||
});
|
||||
|
@@ -67,7 +67,7 @@ export function redirect(url: string): () => Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
const PASSWORD_REQUIRED = 'error.password_required';
|
||||
const INVALID_PASSWORD = 'error.password_incorrect';
|
||||
const LOGIN_REQUIRED = 'error.login_required';
|
||||
const ACTIVATION_REQUIRED = 'error.account_not_activated';
|
||||
const TOTP_REQUIRED = 'error.totp_required';
|
||||
@@ -79,7 +79,7 @@ export function login({
|
||||
rememberMe = false,
|
||||
}: {
|
||||
login: string;
|
||||
password?: string;
|
||||
password: string;
|
||||
totp?: string;
|
||||
rememberMe?: boolean;
|
||||
}) {
|
||||
@@ -88,7 +88,7 @@ export function login({
|
||||
.then(authHandler(dispatch))
|
||||
.catch((resp) => {
|
||||
if (resp.errors) {
|
||||
if (resp.errors.password === PASSWORD_REQUIRED) {
|
||||
if (resp.errors.password === INVALID_PASSWORD && password === '') {
|
||||
return dispatch(setLogin(login));
|
||||
} else if (resp.errors.login === ACTIVATION_REQUIRED) {
|
||||
return dispatch(needActivation({ login }));
|
||||
|
@@ -17,7 +17,7 @@ export function login({
|
||||
rememberMe = false,
|
||||
}: {
|
||||
login: string;
|
||||
password?: string;
|
||||
password: string;
|
||||
totp?: string;
|
||||
rememberMe: boolean;
|
||||
}): Promise<OAuthResponse> {
|
||||
|
Reference in New Issue
Block a user