Browse Source

UI: Fixed email validation in form reset password

pull/3990/head
Vladyslav_Prykhodko 6 years ago
parent
commit
fdfd090b0b
  1. 2
      ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.html
  2. 22
      ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.ts

2
ui-ngx/src/app/modules/login/pages/login/reset-password-request.component.html

@ -28,7 +28,7 @@
<fieldset [disabled]="isLoading$ | async">
<div tb-toast fxLayout="column" class="layout-padding">
<span style="height: 50px;"></span>
<mat-form-field class="mat-block">
<mat-form-field class="mat-block" hideRequiredMarker>
<mat-label translate>login.email</mat-label>
<input matInput type="email" autofocus formControlName="email" email required/>
<mat-icon class="material-icons" matPrefix>email</mat-icon>

22
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<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'
}));
}
);
}
}
}

Loading…
Cancel
Save