Add reestablecer contraseña

se  implementó de mejor manera el reestablecer la contraseña
modificando y agregaron los estilos respectivos a ambas páginas del reestablcer contraseña y revisando que estuvieran los elementos adecuados y la funcionalidad adecuada
This commit is contained in:
Mariela Bonilla 2021-07-16 04:52:02 -06:00
parent 0092d87aae
commit ed51fa3694
9 changed files with 335 additions and 209 deletions

View File

@ -19,3 +19,11 @@ email.reset.title=DataSurvey password reset
email.reset.greeting=Dear {0} email.reset.greeting=Dear {0}
email.reset.text1=For your DataSurvey account a password reset was requested, please click on the URL below to reset it: email.reset.text1=For your DataSurvey account a password reset was requested, please click on the URL below to reset it:
email.reset.text2=Regards, email.reset.text2=Regards,
# Password Restored Mail
email.restored.title=Your password was reset in DataSurvey
email.restored.greeting=Hello, {0}!
email.restored.text1=Your DataSurvey password has been successfully reset..
email.restored.text2=Regards,
email.restored.text3=If you did not make this change, please notify the following email immediately:
email.restored.email=datasurvey@gmail.com

View File

@ -19,3 +19,12 @@ email.reset.title=Reinicio de contraseña de DataSurvey
email.reset.greeting=¡Hola, {0}! email.reset.greeting=¡Hola, {0}!
email.reset.text1=Se ha solicitado el reinicio de la contraseña para su cuenta en DataSurvey. Por favor, haga clic en el siguiente enlace para reiniciarla: email.reset.text1=Se ha solicitado el reinicio de la contraseña para su cuenta en DataSurvey. Por favor, haga clic en el siguiente enlace para reiniciarla:
email.reset.text2=Saludos, email.reset.text2=Saludos,
# Password Restored Mail
email.restored.title=Se restaleció su contraseña en DataSurvey
email.restored.greeting=¡Hola, {0}!
email.restored.text1=Se ha restablecido correctamente su contraseña en DataSurvey.
email.restored.text2=Saludos,
email.restored.text3=Si usted no realizó este cambio, favor notifique inmediatamente al siguiente correo:
email.restored.email=datasurvey@gmail.com

View File

@ -1,14 +1,30 @@
<div> <div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5" style="height: 100vh; background-color: #f1f5f9">
<div class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-4"> <div class="col-xxl-4 col-lg-5">
<h1 jhiTranslate="reset.finish.title">Reset password</h1> <div class="card mt-5">
<!-- Logo -->
<div class="alert alert-danger" jhiTranslate="reset.finish.messages.keymissing" *ngIf="initialized && !key"> <div class="pl-4 pt-4 pr-4 pb-1 text-center">
<strong>The password reset key is missing.</strong> <img src="../../content/img_datasurvey/datasurvey-logo-text-black.svg" alt="" />
</div> </div>
<div class="alert alert-warning" *ngIf="key && !success"> <div class="card-body p-4">
<span jhiTranslate="reset.finish.messages.info">Choose a new password</span> <div class="text-center w-75 m-auto">
<h4
class="text-dark-50 text-center pb-0 fw-bold p-0 m-0"
style="color: #727070; font-weight: 700; font-size: 1.3rem"
jhiTranslate="reset.finish.title"
>
Reset password
</h4>
<p class="mb-4" style="color: rgba(146, 146, 146, 0.664)" *ngIf="key && !success" jhiTranslate="reset.finish.messages.info">
Choose a new password
</p>
</div>
<div>
<div class="alert alert-danger" jhiTranslate="reset.finish.messages.keymissing" *ngIf="initialized && !key">
<strong>The password reset key is missing.</strong>
</div> </div>
<div class="alert alert-danger" *ngIf="error"> <div class="alert alert-danger" *ngIf="error">
@ -16,18 +32,24 @@
>Your password couldn't be reset. Remember a password request is only valid for 24 hours.</span >Your password couldn't be reset. Remember a password request is only valid for 24 hours.</span
> >
</div> </div>
<div *ngIf="success">
<div class="alert alert-success" *ngIf="success"> <div class="alert alert-success text-center my-2">
<span jhiTranslate="reset.finish.messages.success"><strong>Your password has been reset.</strong> Please </span> <span jhiTranslate="reset.finish.messages.success"><strong>Your password has been reset.</strong></span>
<a class="alert-link" routerLink="/login" jhiTranslate="global.messages.info.authenticated.link">sign in</a>. <strong><span jhiTranslate="global.messages.info.authenticated.link">sign in</span></strong>
</div>
<div class="d-flex justify-content-center">
<button class="ds-btn ds-btn--primary" routerLink="/login" jhiTranslate="global.messages.info.authenticated.botonInicio">
sign in</button
>.
</div>
</div> </div>
<div class="alert alert-danger" *ngIf="doNotMatch" jhiTranslate="global.messages.error.dontmatch"> <div class="alert alert-danger" *ngIf="doNotMatch" jhiTranslate="global.messages.error.dontmatch">
The password and its confirmation do not match! The password and its confirmation do not match!
</div> </div>
</div>
<div *ngIf="key && !success"> <div *ngIf="key && !success">
<form name="form" role="form" (ngSubmit)="finishReset()" [formGroup]="passwordForm"> <form name="form" class="ds-form" role="form" (ngSubmit)="finishReset()" [formGroup]="passwordForm">
<div class="form-group"> <div class="form-group">
<label class="form-control-label" for="newPassword" jhiTranslate="global.form.newpassword.label">New password</label> <label class="form-control-label" for="newPassword" jhiTranslate="global.form.newpassword.label">New password</label>
<input <input
@ -60,7 +82,7 @@
*ngIf="passwordForm.get('newPassword')?.errors?.minlength" *ngIf="passwordForm.get('newPassword')?.errors?.minlength"
jhiTranslate="global.messages.validate.newpassword.minlength" jhiTranslate="global.messages.validate.newpassword.minlength"
> >
Your password is required to be at least 4 characters. Your password is required to be at least 8 characters.
</small> </small>
<small <small
@ -72,7 +94,7 @@
</small> </small>
</div> </div>
<jhi-password-strength-bar [passwordToCheck]="passwordForm.get('newPassword')!.value"></jhi-password-strength-bar> <!--<jhi-password-strength-bar [passwordToCheck]="passwordForm.get('newPassword')!.value"></jhi-password-strength-bar>-->
</div> </div>
<div class="form-group"> <div class="form-group">
@ -108,7 +130,7 @@
*ngIf="passwordForm.get('confirmPassword')?.errors?.minlength" *ngIf="passwordForm.get('confirmPassword')?.errors?.minlength"
jhiTranslate="global.messages.validate.confirmpassword.minlength" jhiTranslate="global.messages.validate.confirmpassword.minlength"
> >
Your password confirmation is required to be at least 4 characters. Your password confirmation is required to be at least 8 characters.
</small> </small>
<small <small
@ -121,17 +143,30 @@
</div> </div>
</div> </div>
<div class="row justify-content-center">
<button <button
type="submit" type="submit"
[disabled]="passwordForm.invalid" [disabled]="passwordForm.invalid"
class="btn btn-primary" class="ds-btn ds-btn--primary"
jhiTranslate="reset.finish.form.button" jhiTranslate="reset.finish.form.button"
data-cy="submit" data-cy="submit"
> >
Reset Password Reset Password
</button> </button>
</div>
</form> </form>
</div> </div>
</div> </div>
<!-- end card-body -->
</div> </div>
<!-- end card -->
<!-- end row -->
</div> </div>
<!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->

View File

@ -19,8 +19,8 @@ export class PasswordResetFinishComponent implements OnInit, AfterViewInit {
key = ''; key = '';
passwordForm = this.fb.group({ passwordForm = this.fb.group({
newPassword: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(50)]], newPassword: ['', [Validators.required, Validators.minLength(8), Validators.maxLength(50)]],
confirmPassword: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(50)]], confirmPassword: ['', [Validators.required, Validators.minLength(8), Validators.maxLength(50)]],
}); });
constructor(private passwordResetFinishService: PasswordResetFinishService, private route: ActivatedRoute, private fb: FormBuilder) {} constructor(private passwordResetFinishService: PasswordResetFinishService, private route: ActivatedRoute, private fb: FormBuilder) {}

View File

@ -1,21 +1,38 @@
<div> <div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5" style="height: 100vh; background-color: #f1f5f9">
<div class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-8"> <div class="col-xxl-4 col-lg-5">
<h1 jhiTranslate="reset.request.title">Reset your password</h1> <div class="card mt-5">
<!-- Logo -->
<jhi-alert-error></jhi-alert-error> <div class="pl-4 pt-4 pr-4 pb-1 text-center">
<img src="../../content/img_datasurvey/datasurvey-logo-text-black.svg" alt="" />
<div class="alert alert-warning" *ngIf="!success">
<span jhiTranslate="reset.request.messages.info">Enter the email address you used to register.</span>
</div> </div>
<div class="card-body p-4">
<div class="text-center w-75 m-auto">
<h4
class="text-dark-50 text-center pb-0 fw-bold p-0 m-0"
style="color: #727070; font-weight: 700; font-size: 1.3rem"
jhiTranslate="reset.request.title"
>
RESET YOUR PASSWORDD
</h4>
<p class="mb-4" style="color: rgba(146, 146, 146, 0.664)" jhiTranslate="reset.request.messages.info">
Enter the email address you used to register.
</p>
</div>
<div>
<div class="alert alert-success" *ngIf="success"> <div class="alert alert-success" *ngIf="success">
<span jhiTranslate="reset.request.messages.success">Check your emails for details on how to reset your password.</span> <span jhiTranslate="reset.request.messages.success">Check your emails for details on how to reset your password.</span>
</div> </div>
<form *ngIf="!success" name="form" role="form" (ngSubmit)="requestReset()" [formGroup]="resetRequestForm"> <div class="alert alert-danger" *ngIf="errorEmailNotExists" jhiTranslate="reset.request.messages.error.emailnotexists">
<strong>Email no exists!</strong> Please choose another one.
</div>
</div>
<form *ngIf="!success" name="form" class="ds-form" role="form" (ngSubmit)="requestReset()" [formGroup]="resetRequestForm">
<div class="form-group"> <div class="form-group">
<label class="form-control-label" for="email" jhiTranslate="global.form.email.label">Email</label> <label class="form-label" for="email" jhiTranslate="global.form.email.label">Email</label>
<input <input
type="email" type="email"
class="form-control" class="form-control"
@ -29,7 +46,8 @@
<div <div
*ngIf=" *ngIf="
resetRequestForm.get('email')!.invalid && (resetRequestForm.get('email')!.dirty || resetRequestForm.get('email')!.touched) resetRequestForm.get('email')!.invalid &&
(resetRequestForm.get('email')!.dirty || resetRequestForm.get('email')!.touched)
" "
> >
<small <small
@ -63,19 +81,52 @@
> >
Your email cannot be longer than 100 characters. Your email cannot be longer than 100 characters.
</small> </small>
<small class="form-text text-danger" *ngIf="resetRequestForm.get('email')?.errors?.email">
Se requiere un correo electrónico válido.
</small>
</div> </div>
</div> </div>
<div class="row justify-content-center">
<button
type="button"
id="cancel-save"
data-cy="entityCreateCancelButton"
class="ds-btn ds-btn--secondary"
(click)="previousState()"
>
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="entity.action.back">Volver</span>
</button>
<button <button
type="submit" type="submit"
[disabled]="resetRequestForm.invalid" [disabled]="resetRequestForm.invalid"
class="btn btn-primary" class="ds-btn ds-btn--primary"
jhiTranslate="reset.request.form.button" jhiTranslate="reset.request.form.button"
data-cy="submit" data-cy="submit"
> >
Reset Reset
</button> </button>
</div>
</form> </form>
</div> </div>
<!-- end card-body -->
</div> </div>
<!-- end card -->
<div class="row mt-3">
<div class="col-12 text-center">
<p class="text-muted">
¿Aún no se encuentra registrado/a?
<a routerLink="/account/register" class="text-muted ms-1"><b>Crea una cuenta</b></a>
</p>
</div> </div>
<!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->

View File

@ -2,6 +2,8 @@ import { Component, AfterViewInit, ElementRef, ViewChild } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { PasswordResetInitService } from './password-reset-init.service'; import { PasswordResetInitService } from './password-reset-init.service';
import { HttpErrorResponse } from '@angular/common/http';
import { EMAIL_NOT_EXISTS_TYPE } from '../../../config/error.constants';
@Component({ @Component({
selector: 'jhi-password-reset-init', selector: 'jhi-password-reset-init',
@ -10,7 +12,8 @@ import { PasswordResetInitService } from './password-reset-init.service';
export class PasswordResetInitComponent implements AfterViewInit { export class PasswordResetInitComponent implements AfterViewInit {
@ViewChild('email', { static: false }) @ViewChild('email', { static: false })
email?: ElementRef; email?: ElementRef;
errorEmailNotExists = false;
error = false;
success = false; success = false;
resetRequestForm = this.fb.group({ resetRequestForm = this.fb.group({
email: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]], email: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]],
@ -25,6 +28,22 @@ export class PasswordResetInitComponent implements AfterViewInit {
} }
requestReset(): void { requestReset(): void {
this.passwordResetInitService.save(this.resetRequestForm.get(['email'])!.value).subscribe(() => (this.success = true)); this.errorEmailNotExists = false;
this.passwordResetInitService.save(this.resetRequestForm.get(['email'])!.value).subscribe(
() => (this.success = true),
response => this.processError(response)
);
}
previousState(): void {
window.history.back();
}
processError(response: HttpErrorResponse): void {
if (response.status === 400 && response.error.type === EMAIL_NOT_EXISTS_TYPE) {
this.errorEmailNotExists = true;
} else {
this.error = true;
}
} }
} }

View File

@ -2,8 +2,8 @@
"activate": { "activate": {
"title": "Activación", "title": "Activación",
"messages": { "messages": {
"success": "<strong>Su cuenta ha sido activada.</strong> Por favor, ", "success": "<strong>Su cuenta ha sido activada.</strong> Ya puede ",
"error": "<strong>Su cuenta no pudo ser activada.</strong> Por favor, utilice el formulario de inscripción para registrarse." "error": "<strong>Su cuenta no pudo ser activada.</strong> Por favor, regístrese en DataSurvey."
} }
} }
} }

View File

@ -65,7 +65,8 @@
"authenticated": { "authenticated": {
"prefix": "Si desea ", "prefix": "Si desea ",
"link": "iniciar sesión", "link": "iniciar sesión",
"suffix": ", puede intentar con las cuentas predeterminadas:<br/>- Administrador (usuario=\"admin\" y contraseña=\"admin\") <br/>- Usuario (usuario=\"user\" y contraseña=\"user\")." "suffix": ", puede intentar con las cuentas predeterminadas:<br/>- Administrador (usuario=\"admin\" y contraseña=\"admin\") <br/>- Usuario (usuario=\"user\" y contraseña=\"user\").",
"botonInicio": "Iniciar Sesión"
}, },
"register": { "register": {
"noaccount": "¿Aún no tienes una cuenta?", "noaccount": "¿Aún no tienes una cuenta?",

View File

@ -7,7 +7,10 @@
}, },
"messages": { "messages": {
"info": "Introduzca la dirección de correo electrónico que utilizó para registrarse", "info": "Introduzca la dirección de correo electrónico que utilizó para registrarse",
"success": "Revise su correo electrónico para obtener más información sobre cómo restablecer su contraseña." "success": "Revise su correo electrónico para obtener más información sobre cómo restablecer su contraseña.",
"error": {
"emailnotexists": "<strong>¡El correo electrónico no se encuentra registrado en el sistema!</strong> Por favor, ingrese otro email."
}
} }
}, },
"finish": { "finish": {