|
|
@@ -33,12 +33,12 @@
|
|
|
@submit="onSubmit"
|
|
|
>
|
|
|
<DefaultInput
|
|
|
- v-model="form.email"
|
|
|
- v-model:error="validationErrors.email"
|
|
|
- type="email"
|
|
|
+ v-model="form.identifier"
|
|
|
+ v-model:error="validationErrors.identifier"
|
|
|
+ :type="isAssociado ? 'text' : 'email'"
|
|
|
autofocus
|
|
|
- :label="$t('common.terms.email')"
|
|
|
- :rules="[inputRules.required, inputRules.email]"
|
|
|
+ :label="isAssociado ? $t('auth.email_or_badge') : $t('common.terms.email')"
|
|
|
+ :rules="isAssociado ? [inputRules.required] : [inputRules.required, inputRules.email]"
|
|
|
>
|
|
|
<template #append>
|
|
|
<q-icon name="mdi-account-outline" color="grey-5" />
|
|
|
@@ -84,7 +84,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, onBeforeMount, useTemplateRef } from "vue";
|
|
|
+import { ref, computed, onBeforeMount, useTemplateRef } from "vue";
|
|
|
import { useQuasar } from "quasar";
|
|
|
import { useAuth } from "src/composables/useAuth";
|
|
|
import { useRouter } from "vue-router";
|
|
|
@@ -104,6 +104,7 @@ const store = userStore();
|
|
|
|
|
|
const formRef = useTemplateRef("formRef");
|
|
|
const selectedTipo = ref("administrador");
|
|
|
+const isAssociado = computed(() => selectedTipo.value === "associado");
|
|
|
|
|
|
const userTypes = [
|
|
|
{ value: "associado", label: "auth.type.associado", icon: "mdi-account-outline" },
|
|
|
@@ -128,18 +129,18 @@ const {
|
|
|
});
|
|
|
|
|
|
const form = ref({
|
|
|
- email: null,
|
|
|
+ identifier: null,
|
|
|
password: process.env.PASSWORD ?? null,
|
|
|
});
|
|
|
|
|
|
const onSubmit = async () => {
|
|
|
- await submitForm(() => login(form.value.email, form.value.password, selectedTipo.value));
|
|
|
+ await submitForm(() => login(form.value.identifier, form.value.password, selectedTipo.value));
|
|
|
};
|
|
|
|
|
|
onBeforeMount(() => {
|
|
|
const savedEmail = $q.cookies.get("email");
|
|
|
if (savedEmail) {
|
|
|
- form.value.email = savedEmail;
|
|
|
+ form.value.identifier = savedEmail;
|
|
|
}
|
|
|
});
|
|
|
</script>
|