|
@@ -16,13 +16,12 @@
|
|
|
@submit="onSubmit"
|
|
@submit="onSubmit"
|
|
|
>
|
|
>
|
|
|
<DefaultInput
|
|
<DefaultInput
|
|
|
- v-model="form.email"
|
|
|
|
|
- v-model:error="validationErrors.email"
|
|
|
|
|
- type="email"
|
|
|
|
|
|
|
+ v-model="form.identifier"
|
|
|
|
|
+ v-model:error="validationErrors.identifier"
|
|
|
autofocus
|
|
autofocus
|
|
|
color="violet-normal"
|
|
color="violet-normal"
|
|
|
- :rules="[inputRules.required, inputRules.email]"
|
|
|
|
|
- :label="$t('common.terms.email')"
|
|
|
|
|
|
|
+ :rules="[inputRules.required]"
|
|
|
|
|
+ :label="$t('auth.email_or_badge')"
|
|
|
lazy-rules
|
|
lazy-rules
|
|
|
>
|
|
>
|
|
|
<template #append>
|
|
<template #append>
|
|
@@ -113,20 +112,20 @@ const {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const form = ref({
|
|
const form = ref({
|
|
|
- email: null,
|
|
|
|
|
|
|
+ identifier: null,
|
|
|
password: process.env.PASSWORD ?? null,
|
|
password: process.env.PASSWORD ?? null,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const checkbox = ref(false);
|
|
const checkbox = ref(false);
|
|
|
|
|
|
|
|
const onSubmit = async () => {
|
|
const onSubmit = async () => {
|
|
|
- await submitForm(() => login(form.value.email, form.value.password));
|
|
|
|
|
- const email_storage = $q.cookies.get("email");
|
|
|
|
|
- if (email_storage && !checkbox.value) {
|
|
|
|
|
- $q.cookies.remove("email");
|
|
|
|
|
|
|
+ await submitForm(() => login(form.value.identifier, form.value.password));
|
|
|
|
|
+ const saved = $q.cookies.get("login_identifier");
|
|
|
|
|
+ if (saved && !checkbox.value) {
|
|
|
|
|
+ $q.cookies.remove("login_identifier");
|
|
|
}
|
|
}
|
|
|
if (checkbox.value) {
|
|
if (checkbox.value) {
|
|
|
- $q.cookies.set("email", form.value.email, {
|
|
|
|
|
|
|
+ $q.cookies.set("login_identifier", form.value.identifier, {
|
|
|
path: "/",
|
|
path: "/",
|
|
|
sameSite: "Lax",
|
|
sameSite: "Lax",
|
|
|
});
|
|
});
|
|
@@ -134,10 +133,10 @@ const onSubmit = async () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
onBeforeMount(() => {
|
|
onBeforeMount(() => {
|
|
|
- const email_storage = $q.cookies.get("email");
|
|
|
|
|
- if (email_storage) {
|
|
|
|
|
|
|
+ const saved = $q.cookies.get("login_identifier");
|
|
|
|
|
+ if (saved) {
|
|
|
checkbox.value = true;
|
|
checkbox.value = true;
|
|
|
- form.value.email = email_storage;
|
|
|
|
|
|
|
+ form.value.identifier = saved;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|