Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 4x 4x 4x 4x 4x 4x 4x 3x 2x 2x 1x 1x 1x 1x 1x | import { Component } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { Router, RouterLink } from '@angular/router';
import { catchError, take, throwError } from 'rxjs';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { NgxCaptchaModule } from 'ngx-captcha';
import { NotificationService } from '@core/services/notification.service';
import { ResetPasswordRequest } from '@core/model/reset-password-request.interface';
import { UserService } from '@core/services/user.service';
import { StatusIconComponent } from "@layout/shared/status-icon/status-icon.component";
import { ErrorProcessorService } from '@core/services/error-processor.service';
@Component({
selector: 'app-reset-password',
standalone: true,
imports: [MatButtonModule, MatFormFieldModule, MatIconModule, MatInputModule, ReactiveFormsModule, NgxCaptchaModule, StatusIconComponent],
templateUrl: './reset-password.component.html',
styleUrl: './reset-password.component.scss'
})
export class ResetPasswordComponent {
public form: FormGroup;
public isSubmitting = false;
constructor(
private userService: UserService,
private router: Router,
private fb: FormBuilder,
private notificationService: NotificationService,
private errorProcessorService: ErrorProcessorService
) {
this.form = this.fb.group({
email: [
'',
[
Validators.required,
Validators.email
],
],
});
}
get email() {
return this.form.get('email');
}
submit() :void {
if(!this.isSubmitting && this.form.valid) {
this.isSubmitting = true;
this.userService.resetPassword(this.form.value as ResetPasswordRequest)
.pipe(
take(1),
catchError(
() => {
this.isSubmitting = false;
return this.errorProcessorService.processError(new Error('Password request failed'));
}
))
.subscribe(() => {
this.isSubmitting = false;
this.notificationService.confirmation($localize `:@@info.password.reset.processed:Your request has been processed. If your email is linked to an account, an email has been sent. Please check your emails for further instructions.`);
this.router.navigate(["/"])
});
}
}
}
|