add: translations of profile & proposals

This commit is contained in:
Alexandro Uc Santos
2024-06-01 17:17:34 -06:00
parent 2de6b5b4fd
commit 97f4f93fd3
14 changed files with 267 additions and 124 deletions

View File

@@ -7,6 +7,7 @@
import { useAuthStore } from '../stores/auth';
import { useRouter } from 'vue-router';
import { useNotificationsStore } from '../stores/notifications';
import { useI18n } from 'vue-i18n';
const pwdForm = reactive({
pwd: '',
@@ -24,6 +25,7 @@
const loading = ref(false)
const msgError = ref('');
const msgSuccess = ref('');
const { t } = useI18n()
const hangleSave = async() => {
msgError.value = '';
@@ -42,7 +44,7 @@
}
const result = await recoveryPassword(data);
if(result.msg === 'success' && result.data !== null) {
msgSuccess.value = 'Te enviamos un código al correo, ingresado!';
msgSuccess.value = t('messages.sendCode')
pwdForm.checksum = result.data.checksum;
step.value = 2;
clearMessages();
@@ -58,7 +60,7 @@
msgError.value = '';
msgSuccess.value = '';
if(pwdForm.code.length < 6) {
msgError.value = 'Ingresa código valido';
msgError.value = t('errors.code');
clearMessages();
return;
} else {
@@ -81,7 +83,7 @@
});
clearMessages();
notifications.$patch({
text : 'Contraseña se ha cambiando exitosamente!',
text : t('messages.changePassword'),
show : true,
error: false
});
@@ -121,9 +123,9 @@
const pass = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/;
if(!pass.test(pwdForm.pwd)) {
return 'Contraseña poco segura';
return t('errors.weakPassword')
} else if (pwdForm.pwd !== pwdForm.pwd2) {
return 'Las contraseñas no coinciden';
return t('errors.matchPassword');
} else {
return '';
}
@@ -146,20 +148,20 @@
v-if="step === 1"
>
<br/>
<h3 class="title">Cambiar contraseña</h3>
<h3 class="title">{{ t('profile.changePassword') }}</h3>
<br/>
<NotificationBadge :msg="msgError" v-if="msgError != ''"/>
<NotificationBadge :msg="msgSuccess" v-if="msgSuccess != ''" :is-error="false"/>
<CustomInput
label=" Nueva contraseña*:"
:label="t('labels.password2') + '*:'"
type="password"
name="pwd"
:filled="false"
v-model:field="pwdForm.pwd"
help-text="La Contraseña debe ser mínimo 8 caracteres, al menos una mayúscula, al menos una minúscula, y un digito."
:help-text="t('login.helptext')"
/>
<CustomInput
label="Confirme contraseña*:"
:label="t('labels.password3') + '*:'"
type="password"
name="pwd2"
:step="1"
@@ -168,26 +170,26 @@
/>
<div class="warning-info">
<div><i class="fa-solid fa-triangle-exclamation warning"></i></div>
Esta acción cerrara su sesión actual y debera volver a iniciar sesión con su nueva contraseña
{{ t('profile.helpTextResetPass') }}
</div>
<div class="mt-5 text-center">
<Spiner v-if="loading"/>
<button
v-else
class="btn btn-dark btn-block" type="submit">Continuar</button>
class="btn btn-dark btn-block" type="submit">{{ t('buttons.continue') }}</button>
</div>
</form>
<form v-if="step === 2" @submit.prevent="handleConfirmChange" class="mx-5">
<div class="d-flex justify-content-center align-items-center mb-4 mt-4">
<a
@click="handleBack(1)"
class="btn-text ms-2"><i class="fa-solid fa-arrow-left"></i> Volver</a>
class="btn-text ms-2"><i class="fa-solid fa-arrow-left"></i> {{ t('buttons.back') }}</a>
</div>
<NotificationBadge :msg="msgError" v-if="msgError != ''"/>
<NotificationBadge :msg="msgSuccess" :is-error="false" v-if="msgSuccess != ''"/>
<p class="help-info">Te enviamos un código de verificación al correo electrónico, ingresalo para confirmar la recuperacion de contraseña. No olvides revisar en la carpeta spam</p>
<p class="help-info">{{ t('login.helptextCode') }}</p>
<CustomInput
label="Ingresa el código"
:label="t('labels.code') + '*:'"
name="code"
:filled="false"
type="text"
@@ -202,7 +204,7 @@
<Spiner v-if="loading"/>
<button
v-else
class="btn btn-dark btn-block" type="submit">Confirmar</button>
class="btn btn-dark btn-block" type="submit">{{ t('buttons.confirm') }}</button>
</div>
</form>
</template>