@@ -2,7 +2,15 @@ import { Component, OnDestroy, inject } from '@angular/core';
22import { FormControl , FormGroup , ReactiveFormsModule } from '@angular/forms' ;
33import { Router , RouterLink } from '@angular/router' ;
44
5- import { FormBuilderExtended , MagmaInput , MagmaInputElement , MagmaInputText , testEmail } from '@ikilote/magma' ;
5+ import {
6+ FormBuilderExtended ,
7+ MagmaBlockMessage ,
8+ MagmaInput ,
9+ MagmaInputElement ,
10+ MagmaInputText ,
11+ MagmaMessage ,
12+ testEmail ,
13+ } from '@ikilote/magma' ;
614import { TranslocoPipe , TranslocoService } from '@jsverse/transloco' ;
715
816import { APIUserService } from 'src/app/services/api.user.service' ;
@@ -13,7 +21,16 @@ import { Subscriptions } from 'src/app/tools/subscriptions';
1321 selector : 'user-pw-lost' ,
1422 templateUrl : './user-pw-lost.component.html' ,
1523 styleUrls : [ './user-pw-lost.component.scss' ] ,
16- imports : [ RouterLink , TranslocoPipe , ReactiveFormsModule , MagmaInput , MagmaInputElement , MagmaInputText ] ,
24+ imports : [
25+ RouterLink ,
26+ TranslocoPipe ,
27+ ReactiveFormsModule ,
28+ MagmaInput ,
29+ MagmaInputElement ,
30+ MagmaInputText ,
31+ MagmaMessage ,
32+ MagmaBlockMessage ,
33+ ] ,
1734} )
1835export class UserPwLostComponent implements OnDestroy {
1936 private readonly router = inject ( Router ) ;
@@ -22,7 +39,6 @@ export class UserPwLostComponent implements OnDestroy {
2239 private readonly global = inject ( GlobalService ) ;
2340 private readonly fbe = inject ( FormBuilderExtended ) ;
2441
25- email = '' ;
2642 showError = '' ;
2743 valide = false ;
2844
@@ -70,15 +86,16 @@ export class UserPwLostComponent implements OnDestroy {
7086
7187 this . fbe . validateForm ( this . form ) ;
7288 if ( this . form . valid ) {
73- if ( this . email . trim ( ) === '' ) {
89+ const email = this . form . value . email ;
90+ if ( ! email || email ?. trim ( ) === '' ) {
7491 this . showError = this . translate . translate ( 'error.api-code.1020' ) ;
75- } else if ( ! testEmail ( this . email ) ) {
92+ } else if ( ! testEmail ( email ) ) {
7693 this . showError = this . translate . translate ( 'error.email.invalid' ) ;
7794 }
7895
7996 if ( ! this . showError . length ) {
8097 this . userService
81- . passwordLost ( this . email )
98+ . passwordLost ( email ! )
8299 . then ( ( ) => {
83100 this . valide = true ;
84101 } )
0 commit comments