X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Breset-password%2Freset-password.component.ts;h=11c5110fd73bacb31cbc4fc851faf40fc379f981;hb=7337a75bf06dd3ee501b502c1e4251dbf78aa04d;hp=16e4f4090c84c62e3170f051d4a13cadbfd47680;hpb=66357162f8e1227495f09bd4f68446aad7071c6d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+reset-password/reset-password.component.ts b/client/src/app/+reset-password/reset-password.component.ts index 16e4f4090..11c5110fd 100644 --- a/client/src/app/+reset-password/reset-password.component.ts +++ b/client/src/app/+reset-password/reset-password.component.ts @@ -1,7 +1,9 @@ import { Component, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { Notifier, UserService } from '@app/core' -import { FormReactive, FormValidatorService, ResetPasswordValidatorsService, UserValidatorsService } from '@app/shared/shared-forms' +import { RESET_PASSWORD_CONFIRM_VALIDATOR } from '@app/shared/form-validators/reset-password-validators' +import { USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators' +import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' @Component({ selector: 'my-login', @@ -15,20 +17,18 @@ export class ResetPasswordComponent extends FormReactive implements OnInit { constructor ( protected formValidatorService: FormValidatorService, - private resetPasswordValidatorsService: ResetPasswordValidatorsService, - private userValidatorsService: UserValidatorsService, private userService: UserService, private notifier: Notifier, private router: Router, private route: ActivatedRoute - ) { + ) { super() } ngOnInit () { this.buildForm({ - password: this.userValidatorsService.USER_PASSWORD, - 'password-confirm': this.resetPasswordValidatorsService.RESET_PASSWORD_CONFIRM + password: USER_PASSWORD_VALIDATOR, + 'password-confirm': RESET_PASSWORD_CONFIRM_VALIDATOR }) this.userId = this.route.snapshot.queryParams['userId'] @@ -42,14 +42,14 @@ export class ResetPasswordComponent extends FormReactive implements OnInit { resetPassword () { this.userService.resetPassword(this.userId, this.verificationString, this.form.value.password) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Your password has been successfully reset!`) this.router.navigate([ '/login' ]) }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } isConfirmedPasswordValid () {