|
|
@@ -56,6 +56,16 @@
|
|
|
:label="$t('auth.first_access.registration')"
|
|
|
/>
|
|
|
|
|
|
+ <DefaultInput
|
|
|
+ v-model="form.cpf"
|
|
|
+ v-model:error="validationErrors.cpf"
|
|
|
+ :readonly="isLocked('cpf')"
|
|
|
+ :bg-color="isLocked('cpf') ? 'grey-2' : undefined"
|
|
|
+ :mask="masks.Brasil.cpf"
|
|
|
+ :label="$t('common.terms.cpf')"
|
|
|
+ :rules="[inputRules.required, inputRules.cpf]"
|
|
|
+ />
|
|
|
+
|
|
|
<DefaultInput
|
|
|
v-model="form.name"
|
|
|
v-model:error="validationErrors.name"
|
|
|
@@ -66,13 +76,12 @@
|
|
|
/>
|
|
|
|
|
|
<DefaultInput
|
|
|
- v-model="form.cpf"
|
|
|
- v-model:error="validationErrors.cpf"
|
|
|
- :readonly="isLocked('cpf')"
|
|
|
- :bg-color="isLocked('cpf') ? 'grey-2' : undefined"
|
|
|
- :mask="masks.Brasil.cpf"
|
|
|
- :label="$t('common.terms.cpf')"
|
|
|
- :rules="[inputRules.required, inputRules.cpf]"
|
|
|
+ v-model="form.last_name"
|
|
|
+ v-model:error="validationErrors.last_name"
|
|
|
+ :readonly="isLocked('last_name')"
|
|
|
+ :bg-color="isLocked('last_name') ? 'grey-2' : undefined"
|
|
|
+ :label="$t('auth.first_access.last_name')"
|
|
|
+ :rules="[inputRules.required]"
|
|
|
/>
|
|
|
|
|
|
<DefaultInput
|
|
|
@@ -209,8 +218,9 @@ const sectorOptions = ref([]);
|
|
|
|
|
|
const form = ref({
|
|
|
registration: null,
|
|
|
- name: null,
|
|
|
cpf: null,
|
|
|
+ name: null,
|
|
|
+ last_name: null,
|
|
|
email: null,
|
|
|
phone: null,
|
|
|
position_id: null,
|
|
|
@@ -271,6 +281,7 @@ const {
|
|
|
|
|
|
const prefillRules = {
|
|
|
name: [inputRules.required],
|
|
|
+ last_name: [inputRules.required],
|
|
|
cpf: [inputRules.required, inputRules.cpf],
|
|
|
email: [inputRules.required, inputRules.email],
|
|
|
phone: [inputRules.required],
|
|
|
@@ -325,7 +336,7 @@ const onSubmit = async () => {
|
|
|
|
|
|
const password = form.value.password;
|
|
|
|
|
|
- const user = await submitForm(() =>
|
|
|
+ const result = await submitForm(() =>
|
|
|
registerFirstAccess({
|
|
|
...form.value,
|
|
|
token: token.value,
|
|
|
@@ -333,10 +344,20 @@ const onSubmit = async () => {
|
|
|
}),
|
|
|
);
|
|
|
|
|
|
- if (!user) return;
|
|
|
+ if (!result) return;
|
|
|
|
|
|
clearFirstAccessData();
|
|
|
|
|
|
+ if (!result.can_login) {
|
|
|
+ $q.notify({
|
|
|
+ type: "warning",
|
|
|
+ message: result.message ?? t("auth.first_access.pending_approval"),
|
|
|
+ timeout: 8000,
|
|
|
+ });
|
|
|
+ router.push({ name: "LoginPage" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
await login(form.value.registration, password, { skipSuccessNotify: true });
|
|
|
$q.notify({ type: "positive", message: t("auth.first_access.success") });
|