Add loginState to skip nami login

This commit is contained in:
philipp lang 2024-07-30 23:22:46 +02:00
parent 38d56d1285
commit 54efebf12e
1 changed files with 27 additions and 5 deletions

View File

@ -13,16 +13,27 @@
Bitte achte außerdem darauf, dass du mindestens <span class="font-semibold">Leserechte</span> auf deine Gruppierung hast. Diese kann dir i.d.R. dein
<span class="font-semibold">StaVo</span> erteilen.
</p>
<v-checkbox
:modelValue="loginState !== 'nami'"
@update:modelValue="loginState = $event ? 'skipping' : 'nami'"
name="login_state"
id="login_state"
description="Ich bin kein Mitglied der DPSG im DV Köln und möchte daher meine Mitglieder selbst eingeben."
intro=""
></v-checkbox>
</div>
<div class="flex mt-4 space-x-3">
<v-text @keypress.enter="innerLogin" name="nami_mglnr" label="Mitgliedsnummer" id="nami_mglnr" v-model="loginData.mglnr" required></v-text>
<v-text @keypress.enter="innerLogin" name="nami_password" label="Passwort" id="nami_password" v-model="loginData.password" type="password" required></v-text>
<v-btn class="self-end" @click.prevent="innerLogin">Anmelden</v-btn>
<v-btn class="self-end" @click.prevent="innerLogin">
<span v-text="loginState === 'nami' ? 'Anmelden' : 'Weiter'"></span>
</v-btn>
</div>
</template>
<template #finished>
<div class="flex items-center justify-between">
<div>Erfolgreich eingeloggt als {{ user }}.</div>
<div v-if="user">Erfolgreich eingeloggt als {{ user }}.</div>
<div v-else>Nicht eingeloggt</div>
<v-btn class="self-end" @click.prevent="innerLogout">Abmelden</v-btn>
</div>
</template>
@ -225,7 +236,7 @@ if (user.value !== null) {
const {resolveComponentName} = useFields();
const step = computed(() => {
if (user.value === null) {
if (user.value === null && loginState.value !== 'skipped') {
return 1;
}
@ -247,6 +258,7 @@ function deleteMember(index) {
}
const membersAccepted = ref(false);
const loginState = ref('nami');
const membersCompleted = ref(false);
const emit = defineEmits(['update:modelValue']);
const props = defineProps({
@ -288,6 +300,13 @@ const inner = computed(
{deep: true},
);
async function innerLogin() {
if (loginState.value === 'skipping') {
loginState.value = 'skipped';
membersAccepted.value = true;
membersCompleted.value = false;
return;
}
await login();
membersAccepted.value = false;
membersCompleted.value = false;
@ -312,8 +331,11 @@ function toggleMember(member) {
}
async function innerLogout() {
logout();
resetSearchData();
if (loginState.value !== 'skipped') {
logout();
resetSearchData();
}
loginState.value = 'nami';
membersAccepted.value = false;
membersCompleted.value = false;
inner.value = [];