Always send password field during login

This commit is contained in:
ErickSkrauch
2025-02-14 16:21:39 +01:00
parent 91145abcf7
commit 20b00574d5
3 changed files with 6 additions and 6 deletions

View File

@@ -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')]]);
}));
});

View File

@@ -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 }));

View File

@@ -17,7 +17,7 @@ export function login({
rememberMe = false,
}: {
login: string;
password?: string;
password: string;
totp?: string;
rememberMe: boolean;
}): Promise<OAuthResponse> {