|
|
|
@ -19,7 +19,7 @@ import { AuthService } from '@core/auth/auth.service'; |
|
|
|
import { Store } from '@ngrx/store'; |
|
|
|
import { AppState } from '@core/core.state'; |
|
|
|
import { PageComponent } from '@shared/components/page.component'; |
|
|
|
import { FormBuilder } from '@angular/forms'; |
|
|
|
import { FormBuilder, Validators } from '@angular/forms'; |
|
|
|
import { ActionNotificationShow } from '@core/notification/notification.actions'; |
|
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
|
|
|
|
|
@ -31,8 +31,8 @@ import { TranslateService } from '@ngx-translate/core'; |
|
|
|
export class ResetPasswordRequestComponent extends PageComponent implements OnInit { |
|
|
|
|
|
|
|
requestPasswordRequest = this.fb.group({ |
|
|
|
email: [''] |
|
|
|
}); |
|
|
|
email: ['', [Validators.email, Validators.required]] |
|
|
|
}, {updateOn: 'submit'}); |
|
|
|
|
|
|
|
constructor(protected store: Store<AppState>, |
|
|
|
private authService: AuthService, |
|
|
|
@ -45,12 +45,16 @@ export class ResetPasswordRequestComponent extends PageComponent implements OnIn |
|
|
|
} |
|
|
|
|
|
|
|
sendResetPasswordLink() { |
|
|
|
this.authService.sendResetPasswordLink(this.requestPasswordRequest.get('email').value).subscribe( |
|
|
|
() => { |
|
|
|
this.store.dispatch(new ActionNotificationShow({ message: this.translate.instant('login.password-link-sent-message'), |
|
|
|
type: 'success' })); |
|
|
|
} |
|
|
|
); |
|
|
|
if (this.requestPasswordRequest.valid) { |
|
|
|
this.authService.sendResetPasswordLink(this.requestPasswordRequest.get('email').value).subscribe( |
|
|
|
() => { |
|
|
|
this.store.dispatch(new ActionNotificationShow({ |
|
|
|
message: this.translate.instant('login.password-link-sent-message'), |
|
|
|
type: 'success' |
|
|
|
})); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|