| 1 |
- {"ast":null,"code":"import { 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 \"src/app/services/auth.service\";\nimport * as i4 from \"@angular/forms\";\nimport * as i5 from \"@angular/material/icon\";\nimport * as i6 from \"@angular/platform-browser\";\nimport * as i7 from \"@angular/common\";\nimport * as i8 from \"@angular/material/button\";\nimport * as i9 from \"@angular/material/input\";\nimport * as i10 from \"@angular/material/form-field\";\nimport * as i11 from \"@angular/material/card\";\nimport * as i12 from \"@angular/material/progress-bar\";\nfunction AdminLoginComponent_mat_progress_bar_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"mat-progress-bar\", 13);\n }\n}\nfunction AdminLoginComponent_mat_error_12_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}\nfunction AdminLoginComponent_mat_error_18_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_r2 = i0.ɵɵnextContext();\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r2.getErrorPassword(), \" \");\n }\n}\nexport let AdminLoginComponent = /*#__PURE__*/(() => {\n class AdminLoginComponent {\n constructor(router, snackBar, authService, formBuilder, matIconRegistry, domSanitizer) {\n this.router = router;\n this.snackBar = snackBar;\n this.authService = authService;\n this.formBuilder = formBuilder;\n this.matIconRegistry = matIconRegistry;\n this.domSanitizer = domSanitizer;\n this.submitted = false;\n this.loading = false;\n this.hide = true;\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 password: [null, [Validators.required, this.checkPassword]]\n });\n }\n checkPassword(control) {\n let enteredPassword = control.value;\n let passwordCheck = /^(?=.*[a-z])(?=.{6,})/;\n return !passwordCheck.test(enteredPassword) && enteredPassword ? {\n 'requirements': true\n } : null;\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 getErrorPassword() {\n return this.formGroup.get('password').hasError('required') ? 'Mot de passe requis' : this.formGroup.get('password').hasError('requirements') ? 'Le mot de passe doit comporter au moins 8 caractères, une lettre majuscule' : '';\n }\n get f() {\n return this.formGroup.controls;\n }\n // login\n signIn() {\n this.submitted = true;\n if (this.formGroup.invalid) {\n return;\n }\n this.loading = true;\n this.authService.signInAdmin(this.formGroup.value).subscribe(data => {\n // this.router.navigate([this.returnUrl]);\n console.log(data);\n this.loading = false;\n this.router.navigate(['/tirage']);\n setTimeout(() => {\n document.location.reload();\n }, 800);\n }, err => {\n this.loading = false;\n console.log(err.error.message);\n this.authService.openSnackBar(err.error.message);\n });\n // this.router.navigate(['/']);\n }\n static #_ = this.ɵfac = function AdminLoginComponent_Factory(t) {\n return new (t || AdminLoginComponent)(i0.ɵɵdirectiveInject(i1.Router), i0.ɵɵdirectiveInject(i2.MatSnackBar), i0.ɵɵdirectiveInject(i3.AuthService), i0.ɵɵdirectiveInject(i4.FormBuilder), i0.ɵɵdirectiveInject(i5.MatIconRegistry), i0.ɵɵdirectiveInject(i6.DomSanitizer));\n };\n static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: AdminLoginComponent,\n selectors: [[\"app-admin-login\"]],\n decls: 25,\n vars: 6,\n consts: [[1, \"container\", \"navtop\"], [1, \"row\", \"justify-content-center\"], [1, \"col-11\", \"col-lg-5\", 2, \"border-radius\", \"10px\"], [\"class\", \"col-12\", \"mode\", \"indeterminate\", 4, \"ngIf\"], [3, \"formGroup\", \"ngSubmit\"], [1, \"col-10\"], [\"matInput\", \"\", \"placeholder\", \"Adresse email\", \"formControlName\", \"email\", \"required\", \"\"], [4, \"ngIf\"], [\"matInput\", \"\", \"placeholder\", \"Mot de passe\", \"formControlName\", \"password\", \"required\", \"\", 3, \"type\"], [\"matSuffix\", \"\", 3, \"click\"], [1, \"row\", \"justify-content-center\", \"mt-3\"], [\"mat-raised-button\", \"\", \"color\", \"primary\", \"type\", \"submit\", 1, \"col-6\", \"color-theme\"], [\"routerLink\", \"/login/lost-password\"], [\"mode\", \"indeterminate\", 1, \"col-12\"]],\n template: function AdminLoginComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 0)(1, \"div\", 1)(2, \"mat-card\", 2);\n i0.ɵɵtemplate(3, AdminLoginComponent_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 AdminLoginComponent_Template_form_ngSubmit_5_listener() {\n return ctx.signIn();\n });\n i0.ɵɵelementStart(6, \"h1\", 1)(7, \"b\");\n i0.ɵɵtext(8, \"Connexion\");\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(9, \"div\", 1)(10, \"mat-form-field\", 5);\n i0.ɵɵelement(11, \"input\", 6);\n i0.ɵɵtemplate(12, AdminLoginComponent_mat_error_12_Template, 2, 1, \"mat-error\", 7);\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(13, \"div\", 1)(14, \"mat-form-field\", 5);\n i0.ɵɵelement(15, \"input\", 8);\n i0.ɵɵelementStart(16, \"mat-icon\", 9);\n i0.ɵɵlistener(\"click\", function AdminLoginComponent_Template_mat_icon_click_16_listener() {\n return ctx.hide = !ctx.hide;\n });\n i0.ɵɵtext(17);\n i0.ɵɵelementEnd();\n i0.ɵɵtemplate(18, AdminLoginComponent_mat_error_18_Template, 2, 1, \"mat-error\", 7);\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(19, \"div\", 10)(20, \"button\", 11);\n i0.ɵɵtext(21, \"Se connecter\");\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(22, \"p\", 10)(23, \"a\", 12);\n i0.ɵɵtext(24, \"Mot de passe oubli\\u00E9 ?\");\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(7);\n i0.ɵɵproperty(\"ngIf\", !ctx.formGroup.controls[\"email\"].valid && ctx.formGroup.controls[\"email\"].touched);\n i0.ɵɵadvance(3);\n i0.ɵɵproperty(\"type\", ctx.hide ? \"password\" : \"text\");\n i0.ɵɵadvance(2);\n i0.ɵɵtextInterpolate(ctx.hide ? \"visibility_off\" : \"visibility\");\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", !ctx.formGroup.controls[\"password\"].valid && ctx.formGroup.controls[\"password\"].touched);\n }\n },\n dependencies: [i7.NgIf, i1.RouterLink, i8.MatButton, i5.MatIcon, i9.MatInput, i10.MatFormField, i10.MatError, i10.MatSuffix, i11.MatCard, i11.MatCardContent, i12.MatProgressBar, i4.ɵNgNoValidate, i4.DefaultValueAccessor, i4.NgControlStatus, i4.NgControlStatusGroup, i4.RequiredValidator, i4.FormGroupDirective, i4.FormControlName],\n styles: [\".navtop[_ngcontent-%COMP%]{margin-top:10em;margin-bottom:3em}.facebooklogin[_ngcontent-%COMP%], .googlelogin[_ngcontent-%COMP%]{margin-bottom:-.5em!important}.marginButton[_ngcontent-%COMP%]{margin-bottom:0!important}\"]\n });\n }\n return AdminLoginComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
|