| 1 |
- {"ast":null,"code":"import { ConfirmMessageComponent } from './../../shared/confirm-message/confirm-message.component';\nimport { Validators } from '@angular/forms';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"@angular/router\";\nimport * as i2 from \"@angular/material/snack-bar\";\nimport * as i3 from \"@angular/material/dialog\";\nimport * as i4 from \"./../../../services/auth.service\";\nimport * as i5 from \"@angular/forms\";\nimport * as i6 from \"@angular/common\";\nimport * as i7 from \"@angular/material/button\";\nimport * as i8 from \"@angular/material/input\";\nimport * as i9 from \"@angular/material/form-field\";\nimport * as i10 from \"@angular/material/card\";\nimport * as i11 from \"@angular/material/progress-bar\";\nfunction LostPasswordComponent_mat_progress_bar_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"mat-progress-bar\", 12);\n }\n}\nfunction LostPasswordComponent_mat_error_14_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"mat-error\");\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r1.getErrorEmail(), \" \");\n }\n}\nexport let LostPasswordComponent = /*#__PURE__*/(() => {\n class LostPasswordComponent {\n constructor(router, snackBar, dialog, authService, formBuilder) {\n this.router = router;\n this.snackBar = snackBar;\n this.dialog = dialog;\n this.authService = authService;\n this.formBuilder = formBuilder;\n this.submitted = false;\n this.loading = false;\n }\n ngOnInit() {\n this.createForm();\n }\n createForm() {\n let emailregex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n this.formGroup = this.formBuilder.group({\n email: [null, [Validators.required, Validators.pattern(emailregex)]]\n });\n }\n getErrorEmail() {\n return this.formGroup.get('email').hasError('required') ? 'Adresse email requise' : this.formGroup.get('email').hasError('pattern') ? 'Adresse email non valide' : '';\n }\n get f() {\n return this.formGroup.controls;\n }\n // lost password\n lostPassword() {\n this.submitted = true;\n if (this.formGroup.invalid) {\n return;\n }\n this.loading = true;\n this.authService.lostPassword(this.formGroup.value).subscribe(data => {\n console.log(JSON.stringify(data));\n this.loading = false;\n this.openDialog(data);\n }, err => {\n this.loading = false;\n this.authService.openSnackBar(err.error.message);\n });\n }\n openDialog(data) {\n const dialogRef = this.dialog.open(ConfirmMessageComponent, {\n width: '38%',\n data: {\n response: data\n }\n });\n dialogRef.afterClosed().subscribe(() => {\n this.router.navigate(['/login']);\n });\n }\n static #_ = this.ɵfac = function LostPasswordComponent_Factory(t) {\n return new (t || LostPasswordComponent)(i0.ɵɵdirectiveInject(i1.Router), i0.ɵɵdirectiveInject(i2.MatSnackBar), i0.ɵɵdirectiveInject(i3.MatDialog), i0.ɵɵdirectiveInject(i4.AuthService), i0.ɵɵdirectiveInject(i5.FormBuilder));\n };\n static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: LostPasswordComponent,\n selectors: [[\"app-lost-password\"]],\n decls: 18,\n vars: 3,\n consts: [[1, \"container\", \"navtop\"], [1, \"row\", \"justify-content-center\"], [1, \"col-10\", \"col-lg-7\", 2, \"border-radius\", \"30px\"], [\"class\", \"col-12\", \"mode\", \"indeterminate\", 4, \"ngIf\"], [3, \"formGroup\", \"ngSubmit\"], [1, \"row\", \"justify-content-center\", \"mt-2\"], [1, \"text-center\"], [1, \"col-10\"], [\"matInput\", \"\", \"placeholder\", \"Adresse email\", \"formControlName\", \"email\", \"required\", \"\"], [4, \"ngIf\"], [1, \"row\", \"justify-content-center\", \"my-3\"], [\"mat-raised-button\", \"\", \"color\", \"primary\", \"type\", \"submit\", 1, \"col-8\", \"col-md-4\", \"color-theme\"], [\"mode\", \"indeterminate\", 1, \"col-12\"]],\n template: function LostPasswordComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 0)(1, \"div\", 1)(2, \"mat-card\", 2);\n i0.ɵɵtemplate(3, LostPasswordComponent_mat_progress_bar_3_Template, 1, 0, \"mat-progress-bar\", 3);\n i0.ɵɵelementStart(4, \"mat-card-content\")(5, \"form\", 4);\n i0.ɵɵlistener(\"ngSubmit\", function LostPasswordComponent_Template_form_ngSubmit_5_listener() {\n return ctx.lostPassword();\n });\n i0.ɵɵelementStart(6, \"h1\", 5)(7, \"b\");\n i0.ɵɵtext(8, \"Mot de passe oubli\\u00E9 ?\");\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(9, \"h3\", 6);\n i0.ɵɵtext(10, \"Pas de probl\\u00E8me ! Renseignez votre adresse e-mail ci-dessous, nous vous enverrons un lien pour r\\u00E9initialiser votre mot de passe.\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(11, \"div\", 1)(12, \"mat-form-field\", 7);\n i0.ɵɵelement(13, \"input\", 8);\n i0.ɵɵtemplate(14, LostPasswordComponent_mat_error_14_Template, 2, 1, \"mat-error\", 9);\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(15, \"div\", 10)(16, \"button\", 11);\n i0.ɵɵtext(17, \" Envoyer\");\n i0.ɵɵelementEnd()()()()()()();\n }\n if (rf & 2) {\n i0.ɵɵadvance(3);\n i0.ɵɵproperty(\"ngIf\", ctx.loading);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"formGroup\", ctx.formGroup);\n i0.ɵɵadvance(9);\n i0.ɵɵproperty(\"ngIf\", !ctx.formGroup.controls[\"email\"].valid || ctx.formGroup.controls[\"email\"].touched);\n }\n },\n dependencies: [i6.NgIf, i7.MatButton, i8.MatInput, i9.MatFormField, i9.MatError, i10.MatCard, i10.MatCardContent, i11.MatProgressBar, i5.ɵNgNoValidate, i5.DefaultValueAccessor, i5.NgControlStatus, i5.NgControlStatusGroup, i5.RequiredValidator, i5.FormGroupDirective, i5.FormControlName],\n styles: [\".navtop[_ngcontent-%COMP%]{margin-top:10em;margin-bottom:5.2em}.marginButton[_ngcontent-%COMP%]{margin-bottom:0!important}\"]\n });\n }\n return LostPasswordComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
|