diff --git a/src/main/webapp/app/account/settings/settings.component.html b/src/main/webapp/app/account/settings/settings.component.html
index 94561c1..b60c1d9 100644
--- a/src/main/webapp/app/account/settings/settings.component.html
+++ b/src/main/webapp/app/account/settings/settings.component.html
@@ -293,10 +293,21 @@
name="passwordForm"
role="form"
novalidate
- (ngSubmit)="save()"
+ (ngSubmit)="savePassword()"
[formGroup]="passwordForm"
>
+
+ Sus contraseña fue actualizada de manera exitosa
+
+
+
+
+ The password and its confirmation do not match!
+
+
This field is required.
+
+
+ Your password is required to be at least 4 characters.
+
+
+
+ Your password cannot be longer than 50 characters.
+
@@ -353,6 +380,22 @@
>
This field is required.
+
+
+ Your password is required to be at least 4 characters.
+
+
+
+ Your password cannot be longer than 50 characters.
+
@@ -384,6 +427,21 @@
>
This field is required.
+
+ Your password is required to be at least 4 characters.
+
+
+
+ Your password cannot be longer than 50 characters.
+
diff --git a/src/main/webapp/app/account/settings/settings.component.ts b/src/main/webapp/app/account/settings/settings.component.ts
index 0c5b543..82ee0f8 100644
--- a/src/main/webapp/app/account/settings/settings.component.ts
+++ b/src/main/webapp/app/account/settings/settings.component.ts
@@ -16,6 +16,7 @@ import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-
import { AccountService } from 'app/core/auth/account.service';
import { LocalStorageService } from 'ngx-webstorage';
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '../../config/error.constants';
+import { PasswordService } from '../password/password.service';
@Component({
selector: 'jhi-settings',
@@ -25,6 +26,7 @@ export class SettingsComponent implements OnInit {
isSaving = false;
success = false;
error = false;
+ doNotMatch = false;
usersSharedCollection: IUser[] = [];
plantillasSharedCollection: IPlantilla[] = [];
@@ -44,9 +46,9 @@ export class SettingsComponent implements OnInit {
//form de la contraseña
passwordForm = this.fb.group({
- password: [null, [Validators.required]],
- passwordNew: [null, [Validators.required]],
- passwordNewConfirm: [null, [Validators.required]],
+ password: [null, [Validators.required], Validators.minLength(8), Validators.maxLength(50)],
+ passwordNew: [null, [Validators.required], Validators.minLength(8), Validators.maxLength(50)],
+ passwordNewConfirm: [null, [Validators.required, Validators.minLength(8), Validators.maxLength(50)]],
});
usuarioExtra: UsuarioExtra | null = null;
@@ -89,7 +91,8 @@ export class SettingsComponent implements OnInit {
protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder,
protected accountService: AccountService,
- private localStorageService: LocalStorageService
+ private localStorageService: LocalStorageService,
+ protected passwordService: PasswordService
) {}
ngOnInit(): void {
@@ -131,6 +134,20 @@ export class SettingsComponent implements OnInit {
console.log(usuarioExtra.fechaNacimiento);
this.subscribeToSaveResponse(this.usuarioExtraService.update(usuarioExtra));
+
+ window.location.reload();
+ }
+
+ savePassword(): void {
+ const password = this.passwordForm.get(['password'])!.value;
+ if (password !== this.passwordForm.get(['passwordNew'])!.value) {
+ this.doNotMatch = true;
+ } else {
+ this.passwordService.save(this.passwordForm.get(['passwordNew'])!.value, password).subscribe(
+ () => (this.success = true),
+ () => (this.error = true)
+ );
+ }
}
trackUserById(index: number, item: IUser): number {
@@ -237,8 +254,6 @@ export class SettingsComponent implements OnInit {
};
}
- protected CreateFormPassword();
-
selectIcon(event: MouseEvent): void {
if (event.target instanceof Element) {
document.querySelectorAll('.active').forEach(e => e.classList.remove('active'));