Started implementing user settings -> security -> e-mail management

This commit is contained in:
2026-04-18 19:28:51 +02:00
parent 4eaaacac2c
commit 20e67ecd85
9 changed files with 254 additions and 53 deletions

View File

@@ -47,7 +47,7 @@ export class Password {
changePasswordRemoveMode = signal(false)
changePasswordPending = signal(false)
changePasswordForm = new FormGroup({
changeEmailForm = new FormGroup({
currentPassword: new FormControl(""),
newPassword: new FormControl(""),
newPasswordRepeat: new FormControl("")
@@ -58,18 +58,18 @@ export class Password {
openChangePasswordDialog(modeRemove: boolean) {
this.changePasswordDialogOpen.set(true)
this.changePasswordRemoveMode.set(modeRemove)
this.changePasswordForm.controls["currentPassword"].clearValidators()
this.changePasswordForm.controls["newPassword"].clearValidators()
this.changePasswordForm.controls["newPasswordRepeat"].clearValidators()
this.changeEmailForm.controls["currentPassword"].clearValidators()
this.changeEmailForm.controls["newPassword"].clearValidators()
this.changeEmailForm.controls["newPasswordRepeat"].clearValidators()
if (!modeRemove) {
this.changePasswordForm.controls["newPassword"].setValidators([Validators.required])
this.changePasswordForm.controls["newPasswordRepeat"].setValidators([Validators.required])
this.changePasswordForm.controls["newPassword"].updateValueAndValidity()
this.changePasswordForm.controls["newPasswordRepeat"].updateValueAndValidity()
this.changeEmailForm.controls["newPassword"].setValidators([Validators.required])
this.changeEmailForm.controls["newPasswordRepeat"].setValidators([Validators.required])
this.changeEmailForm.controls["newPassword"].updateValueAndValidity()
this.changeEmailForm.controls["newPasswordRepeat"].updateValueAndValidity()
}
this.changePasswordForm.controls["currentPassword"].setValidators([Validators.required])
this.changePasswordForm.controls["currentPassword"].updateValueAndValidity()
this.changeEmailForm.controls["currentPassword"].setValidators([Validators.required])
this.changeEmailForm.controls["currentPassword"].updateValueAndValidity()
}
async changePassword(currentPassword: string | null, newPassword: string | null) {
@@ -79,7 +79,7 @@ export class Password {
try {
await service.changePassword(newPassword ?? "", currentPassword ?? "")
} catch (e) {
this.changePasswordForm.controls["currentPassword"].setErrors({incorrect: true})
this.changeEmailForm.controls["currentPassword"].setErrors({incorrect: true})
}
}
}