diff --git a/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.html b/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.html index 2d20022576..8e723d15a4 100644 --- a/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.html +++ b/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.html @@ -28,7 +28,7 @@
- + login.email email diff --git a/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts b/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts index 1515c4fc34..62b8798bf8 100644 --- a/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts +++ b/ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts @@ -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, 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' + })); + } + ); + } } }