Sus contraseña fue actualizada de manera exitosa
+
+ The password and its confirmation do not match!
+
+
+
The password and its confirmation do not match!
@@ -477,7 +493,7 @@
type="submit"
id="save-entity"
data-cy="entityCreateSaveButton"
- [disabled]="isSaving"
+ [disabled]="passwordForm.invalid || isSaving"
class="ds-btn ds-btn--primary"
>
Save
diff --git a/src/main/webapp/app/account/settings/settings.component.ts b/src/main/webapp/app/account/settings/settings.component.ts
index ec613d2..55335fd 100644
--- a/src/main/webapp/app/account/settings/settings.component.ts
+++ b/src/main/webapp/app/account/settings/settings.component.ts
@@ -26,6 +26,7 @@ export class SettingsComponent implements OnInit {
isSaving = false;
success = false;
successPassword = false;
+ samePassword = false;
error = false;
errorPassword = false;
doNotMatch = false;
@@ -49,8 +50,8 @@ export class SettingsComponent implements OnInit {
//form de la contraseña
passwordForm = this.fb.group({
- password: [null, [Validators.required], Validators.minLength(8), Validators.maxLength(50)],
- passwordNew: [null, [Validators.required], Validators.minLength(8), Validators.maxLength(50)],
+ 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)]],
});
@@ -120,7 +121,7 @@ export class SettingsComponent implements OnInit {
}
});
- console.log(this.isGoogle);
+ //console.log(this.isGoogle);
// this.activatedRoute.data.subscribe(({ usuarioExtra }) => {
@@ -143,14 +144,25 @@ export class SettingsComponent implements OnInit {
}
savePassword(): void {
+ this.successPassword = false;
+ this.doNotMatch = false;
+ this.samePassword = false;
+ this.errorPassword = false;
+
const passwordNew = this.passwordForm.get(['passwordNew'])!.value;
- if (passwordNew !== this.passwordForm.get(['passwordNewConfirm'])!.value) {
- this.doNotMatch = true;
+ const passwordOld = this.passwordForm.get(['password'])!.value;
+ if (passwordOld == passwordNew) {
+ this.samePassword = true;
} else {
- this.passwordService.save(this.passwordForm.get(['passwordNew'])!.value, this.passwordForm.get(['password'])!.value).subscribe(
- () => (this.successPassword = true),
- () => (this.errorPassword = true)
- );
+ if (passwordNew !== this.passwordForm.get(['passwordNewConfirm'])!.value) {
+ (this.doNotMatch = true), (this.samePassword = false);
+ } else {
+ this.passwordService.save(passwordNew, passwordOld).subscribe(
+ () => (this.successPassword = true),
+
+ () => (this.errorPassword = true)
+ );
+ }
}
}
@@ -175,15 +187,16 @@ export class SettingsComponent implements OnInit {
protected subscribeToSaveResponse(result: Observable
>): void {
result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
- () => (
- (this.success = true),
- this.router.navigate(['account/settings']).then(() => {
- window.location.reload();
- })
- ),
+ () => ((this.success = true), this.windowReload()),
response => this.processError(response)
);
}
+ windowReload() {
+ this.router.navigate(['account/settings']).then(() => {
+ window.location.reload();
+ });
+ }
+
processError(response: HttpErrorResponse): void {
if (response.status === 400) {
this.error = true;
@@ -217,8 +230,10 @@ export class SettingsComponent implements OnInit {
// Update swiper
this.profileIcon = usuarioExtra.iconoPerfil!;
+
+ console.log(this.profileIcon);
this.profileIcons.forEach(icon => {
- if (parseInt(icon.name.split('C')[1]) === this.profileIcon) {
+ if (icon.name.split('C')[1] === this.profileIcon) {
icon.class = 'active';
}
});
@@ -269,7 +284,7 @@ export class SettingsComponent implements OnInit {
event.target.classList.add('active');
this.profileIcon = +event.target.getAttribute('id')! + 1;
- console.log(this.profileIcon);
+ //console.log(this.profileIcon);
}
}
}
diff --git a/src/main/webapp/app/entities/categoria/categoria.module.ts b/src/main/webapp/app/entities/categoria/categoria.module.ts
index 96383a6..59f2dd3 100644
--- a/src/main/webapp/app/entities/categoria/categoria.module.ts
+++ b/src/main/webapp/app/entities/categoria/categoria.module.ts
@@ -1,14 +1,13 @@
import { NgModule } from '@angular/core';
import { SharedModule } from 'app/shared/shared.module';
import { CategoriaComponent } from './list/categoria.component';
-import { CategoriaDetailComponent } from './detail/categoria-detail.component';
import { CategoriaUpdateComponent } from './update/categoria-update.component';
import { CategoriaDeleteDialogComponent } from './delete/categoria-delete-dialog.component';
import { CategoriaRoutingModule } from './route/categoria-routing.module';
@NgModule({
imports: [SharedModule, CategoriaRoutingModule],
- declarations: [CategoriaComponent, CategoriaDetailComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent],
+ declarations: [CategoriaComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent],
entryComponents: [CategoriaDeleteDialogComponent],
})
export class CategoriaModule {}
diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html
index 3fae047..0289904 100644
--- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html
+++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html
@@ -1,4 +1,4 @@
-