From be0636a832a74f4359c0d0333903befddc8e46d0 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 3 Dec 2024 10:52:59 -0300 Subject: [PATCH] Recover password view and test --- src/components/ui/ImageEditor.vue | 5 - src/i18n/ca-ES/index.js | 1 + src/i18n/en-US/index.js | 1 + src/i18n/es-ES/index.js | 1 + src/i18n/fr-FR/index.js | 1 + src/i18n/pt-PT/index.js | 1 + src/layouts/LoginLayout.vue | 12 +- src/pages/Login/LoginView.vue | 7 +- src/pages/Login/RecoverPassword.vue | 99 +++++++++++++++ src/pages/Login/RememberPassword.vue | 114 ------------------ src/router/index.js | 3 +- src/router/routes.js | 10 +- .../integration/login/RecoverPassword.spec.js | 18 +++ 13 files changed, 139 insertions(+), 134 deletions(-) create mode 100644 src/pages/Login/RecoverPassword.vue delete mode 100644 src/pages/Login/RememberPassword.vue create mode 100644 src/test/cypress/integration/login/RecoverPassword.spec.js diff --git a/src/components/ui/ImageEditor.vue b/src/components/ui/ImageEditor.vue index 046c0ca7..8d1c610f 100644 --- a/src/components/ui/ImageEditor.vue +++ b/src/components/ui/ImageEditor.vue @@ -100,26 +100,21 @@ const onSubmit = async () => { en-US: name: Name file: File - send: Send imageAdded: Image added successfully es-ES: name: Nombre file: Archivo - send: Enviar imageAdded: Imagen añadida correctamente ca-ES: name: Nom file: Arxiu - send: Enviar imageAdded: Imatge afegida correctament fr-FR: name: Nom file: Fichier - send: Envoyer imageAdded: Image ajoutée correctement pt-PT: name: Nome file: Arquivo - send: Enviar imageAdded: Imagen adicionada corretamente diff --git a/src/i18n/ca-ES/index.js b/src/i18n/ca-ES/index.js index 20b088cf..3a09fc17 100644 --- a/src/i18n/ca-ES/index.js +++ b/src/i18n/ca-ES/index.js @@ -134,6 +134,7 @@ export default { minQuantity: 'Quantitat mínima', introduceSearchTerm: 'Introdueix un terme de cerca', noOrdersFound: `No s'han trobat comandes`, + send: 'Enviar', // Image related translations 'Cant lock cache': 'No es pot bloquejar la memòria cau', 'Bad file format': 'Format de fitxer no reconegut', diff --git a/src/i18n/en-US/index.js b/src/i18n/en-US/index.js index e68add91..668ebcf9 100644 --- a/src/i18n/en-US/index.js +++ b/src/i18n/en-US/index.js @@ -168,6 +168,7 @@ export default { minQuantity: 'Minimum quantity', introduceSearchTerm: 'Enter a search term', noOrdersFound: 'No orders found', + send: 'Send', // Image related translations 'Cant lock cache': 'The cache could not be blocked', 'Bad file format': 'Unrecognized file format', diff --git a/src/i18n/es-ES/index.js b/src/i18n/es-ES/index.js index b30f3ed4..6cd7f59d 100644 --- a/src/i18n/es-ES/index.js +++ b/src/i18n/es-ES/index.js @@ -167,6 +167,7 @@ export default { minQuantity: 'Cantidad mínima', introduceSearchTerm: 'Introduce un término de búsqueda', noOrdersFound: 'No se encontrado pedidos', + send: 'Enviar', // Image related translations 'Cant lock cache': 'La caché no pudo ser bloqueada', 'Bad file format': 'Formato de archivo no reconocido', diff --git a/src/i18n/fr-FR/index.js b/src/i18n/fr-FR/index.js index 4ad3ec06..1550c61f 100644 --- a/src/i18n/fr-FR/index.js +++ b/src/i18n/fr-FR/index.js @@ -135,6 +135,7 @@ export default { minQuantity: 'Quantité minimum', introduceSearchTerm: 'Entrez un terme de recherche', noOrdersFound: 'Aucune commande trouvée', + send: 'Envoyer', // Image related translations 'Cant lock cache': "Le cache n'a pas pu être verrouillé", 'Bad file format': 'Format de fichier non reconnu', diff --git a/src/i18n/pt-PT/index.js b/src/i18n/pt-PT/index.js index 7a193eb7..ce5a4f5a 100644 --- a/src/i18n/pt-PT/index.js +++ b/src/i18n/pt-PT/index.js @@ -133,6 +133,7 @@ export default { minQuantity: 'Quantidade mínima', introduceSearchTerm: 'Digite um termo de pesquisa', noOrdersFound: 'Nenhum pedido encontrado', + send: 'Enviar', // Image related translations 'Cant lock cache': 'O cache não pôde ser bloqueado', 'Bad file format': 'Formato de arquivo inválido', diff --git a/src/layouts/LoginLayout.vue b/src/layouts/LoginLayout.vue index 197e7499..3e414f0c 100644 --- a/src/layouts/LoginLayout.vue +++ b/src/layouts/LoginLayout.vue @@ -3,13 +3,11 @@ id="bg" class="fullscreen row justify-center items-center layout-view scroll" > -
- - - - - -
+ + + + + diff --git a/src/pages/Login/LoginView.vue b/src/pages/Login/LoginView.vue index d16f9b8c..8606dbc0 100644 --- a/src/pages/Login/LoginView.vue +++ b/src/pages/Login/LoginView.vue @@ -136,8 +136,11 @@ const loginAsGuest = async () => { outline /> -

- +

+ {{ $t('haveForgottenPassword') }}

diff --git a/src/pages/Login/RecoverPassword.vue b/src/pages/Login/RecoverPassword.vue new file mode 100644 index 00000000..98114f16 --- /dev/null +++ b/src/pages/Login/RecoverPassword.vue @@ -0,0 +1,99 @@ + + + + + + + +en-US: + inputEmail: Input email + rememberPassword: Rememeber password + weSendEmail: We will sent you an email to recover your password + weHaveSentEmailToRecover: We've sent you an email where you can recover your password +es-ES: + inputEmail: Introduce el correo electrónico + rememberPassword: Recordar contraseña + weSendEmail: Te enviaremos un correo para restablecer tu contraseña + weHaveSentEmailToRecover: Te hemos enviado un correo donde podrás recuperar tu contraseña +ca-ES: + inputEmail: Introdueix el correu electrònic + rememberPassword: Recordar contrasenya + weSendEmail: T'enviarem un correu per restablir la teva contrasenya + weHaveSentEmailToRecover: T'hem enviat un correu on podràs recuperar la teva contrasenya +fr-FR: + inputEmail: Entrez l'email + rememberPassword: Se souvenir du mot de passe + weSendEmail: Nous vous enverrons un e-mail pour récupérer votre mot de passe + weHaveSentEmailToRecover: Nous vous avons envoyé un e-mail où vous pouvez récupérer votre mot de passe +pr-BR: + inputEmail: Digite o e-mail + rememberPassword: Lembrar senha + weSendEmail: Enviaremos um e-mail para recuperar sua senha + weHaveSentEmailToRecover: Enviamos um e-mail onde você pode recuperar sua senha + diff --git a/src/pages/Login/RememberPassword.vue b/src/pages/Login/RememberPassword.vue deleted file mode 100644 index 3a6d781e..00000000 --- a/src/pages/Login/RememberPassword.vue +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - -en-US: - user: User - inputEmail: Input email - rememberPassword: Rememeber password - dontWorry: Don't worry! - fillData: Fill the data - weSendEmail: We will sent you an email to recover your password - weHaveSentEmailToRecover: We've sent you an email where you can recover your password - send: Send - return: Return -es-ES: - user: Usuario - inputEmail: Introduce el correo electrónico - rememberPassword: Recordar contraseña - dontWorry: ¡No te preocupes! - fillData: Rellena los datos - weSendEmail: Te enviaremos un correo para restablecer tu contraseña - weHaveSentEmailToRecover: Te hemos enviado un correo donde podrás recuperar tu contraseña - send: Enviar - return: Volver - diff --git a/src/router/index.js b/src/router/index.js index 4568f378..ab2967a8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -39,10 +39,11 @@ export default route(function (/* { store, ssrContext } */) { Router.beforeEach((to, from, next) => { const userStore = useUserStore(); + const allowedRoutes = ['login', 'recoverPassword']; if ( !userStore.storage.getItem('token') && - to.name !== 'login' && + !allowedRoutes.includes(to.name) && !userStore.isGuest ) { return next({ name: 'login' }); diff --git a/src/router/routes.js b/src/router/routes.js index 1a632381..59ceee1c 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -5,17 +5,17 @@ const routes = [ children: [ { name: 'login', - path: '/login/:email?', + path: '', component: () => import('pages/Login/LoginView.vue') }, { - name: 'rememberPassword', - path: '/remember-password', - component: () => import('pages/Login/RememberPassword.vue') + name: 'recoverPassword', + path: 'recover', + component: () => import('pages/Login/RecoverPassword.vue') }, { name: 'resetPassword', - path: '/reset-password', + path: 'reset', component: () => import('pages/Login/ResetPassword.vue') } ] diff --git a/src/test/cypress/integration/login/RecoverPassword.spec.js b/src/test/cypress/integration/login/RecoverPassword.spec.js new file mode 100644 index 00000000..e78a20ff --- /dev/null +++ b/src/test/cypress/integration/login/RecoverPassword.spec.js @@ -0,0 +1,18 @@ +describe('Login Tests', () => { + beforeEach(() => { + cy.visit('/#/login'); + }); + + it('should ssend recover email', () => { + cy.dataCy('recoverPasswordViewLink').should('exist'); + cy.dataCy('recoverPasswordViewLink').click(); + cy.dataCy('recoverPasswordUserInput').find('input').should('exist'); + cy.dataCy('recoverPasswordUserInput').find('input').type('developer'); + cy.dataCy('recoverPasswordSubmitButton').should('exist'); + cy.dataCy('recoverPasswordSubmitButton').click(); + cy.checkNotify( + 'positive', + 'Te hemos enviado un correo donde podrás recuperar tu contraseña' + ); + }); +});