Fix login response handling
This commit is contained in:
@@ -49,12 +49,13 @@ async function onSubmit() {
|
||||
passwordError.value = true;
|
||||
document.getElementById('inputPassword').focus();
|
||||
}
|
||||
} else if (res.status === 200 ) {
|
||||
if (res.body.redirectTo) return window.location.href = res.body.redirectTo;
|
||||
console.error('login success but missing redirectTo in data:', res.body);
|
||||
internalError.value = true;
|
||||
} else {
|
||||
internalError.value = true;
|
||||
}
|
||||
|
||||
if (res.body.redirectTo) return window.location.href = res.body.redirectTo;
|
||||
|
||||
internalError.value = true;
|
||||
console.error('login success but missing redirectTo in data:', res.body);
|
||||
} catch (error) {
|
||||
internalError.value = true;
|
||||
console.error(error);
|
||||
@@ -98,6 +99,7 @@ onMounted(async () => {
|
||||
|
||||
<p class="has-error" v-show="passwordError">{{ $t('login.errorIncorrectCredentials') }}</p>
|
||||
<p class="has-error" v-show="internalError">{{ $t('login.errorInternal') }}</p>
|
||||
<p class="has-error" v-show="totpError">{{ $t('login.errorIncorrect2FAToken') }}</p>
|
||||
|
||||
<form @submit.prevent="onSubmit" v-show="!totpTokenRequired">
|
||||
<input type="submit" style="display: none;"/>
|
||||
@@ -122,7 +124,6 @@ onMounted(async () => {
|
||||
<div class="form-element">
|
||||
<label for="inputTotpToken">{{ $t('login.2faToken') }}</label>
|
||||
<TextInput id="inputTotpToken" v-model="totpToken"/>
|
||||
<p class="has-error" v-show="totpError">{{ $t('login.errorIncorrect2FAToken') }}</p>
|
||||
</div>
|
||||
|
||||
<Button id="totpTokenSubmitButton" style="margin-top: 12px" type="submit" @click.prevent="onSubmit" :loading="busy">{{ $t('login.signInAction') }}</Button>
|
||||
|
||||
Reference in New Issue
Block a user