| 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\";\nfunction LoginComponent_mat_progress_bar_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"mat-progress-bar\", 24);\n }\n}\nfunction LoginComponent_mat_error_32_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 LoginComponent_mat_error_38_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}\nconst googleLogoURL = \"../assets/img/social/google+.svg\";\nconst facebookLogoURL = \"../assets/img/social/facebook.svg\";\nexport let LoginComponent = /*#__PURE__*/(() => {\n class LoginComponent {\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 this.matIconRegistry.addSvgIcon(\"googleLogo\", this.domSanitizer.bypassSecurityTrustResourceUrl(googleLogoURL)), this.matIconRegistry.addSvgIcon(\"facebookLogo\", this.domSanitizer.bypassSecurityTrustResourceUrl(facebookLogoURL));\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.signIn(this.formGroup.value).subscribe(data => {\n // this.router.navigate([this.returnUrl]);\n console.log(data);\n this.loading = false;\n this.router.navigate(['/auth']);\n setTimeout(() => {\n document.location.reload();\n }, 1000);\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 LoginComponent_Factory(t) {\n return new (t || LoginComponent)(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: LoginComponent,\n selectors: [[\"app-login\"]],\n decls: 49,\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, \"row\", \"justify-content-center\", \"mb-3\"], [\"mat-raised-button\", \"\", 1, \"col-10\", \"col-md-8\", \"googlelogin\", 2, \"background-color\", \"#AD0505\", \"color\", \"white\"], [1, \"row\", \"mt-1\", \"ml-3\"], [\"svgIcon\", \"googleLogo\", 1, \"ml-2\"], [1, \"ml-2\", \"marginButton\"], [\"mat-raised-button\", \"\", 1, \"col-10\", \"col-md-8\", \"facebooklogin\", 2, \"background-color\", \"#2121A1\", \"color\", \"white\"], [\"svgIcon\", \"facebookLogo\", 1, \"ml-2\"], [1, \"row\", \"mt-3\", \"justify-content-center\"], [1, \"col-4\"], [1, \"col-1\"], [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\"], [\"_ngcontent-yhd-c250\", \"\", \"routerlink\", \"/login/lost-password\", \"ng-reflect-router-link\", \"/login/lost-password\", \"href\", \"/login/lost-password\", 2, \"color\", \"rgb(0, 81, 168)\", \"background-color\", \"rgb(255, 255, 255)\"], [\"_ngcontent-yhd-c250\", \"\", \"routerlink\", \"/register\", \"ng-reflect-router-link\", \"/register\", \"href\", \"/register\", 1, \"ml-1\", 2, \"color\", \"rgb(0, 81, 168)\", \"background-color\", \"rgb(255, 255, 255)\"], [\"mode\", \"indeterminate\", 1, \"col-12\"]],\n template: function LoginComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 0)(1, \"div\", 1)(2, \"mat-card\", 2);\n i0.ɵɵtemplate(3, LoginComponent_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 LoginComponent_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\", 5)(10, \"button\", 6)(11, \"div\", 7);\n i0.ɵɵelement(12, \"mat-icon\", 8);\n i0.ɵɵelementStart(13, \"p\", 9);\n i0.ɵɵtext(14, \"Se connecter avec Google\");\n i0.ɵɵelementEnd()()()();\n i0.ɵɵelementStart(15, \"div\", 1)(16, \"button\", 10)(17, \"div\", 7);\n i0.ɵɵelement(18, \"mat-icon\", 11);\n i0.ɵɵelementStart(19, \"p\", 9);\n i0.ɵɵtext(20, \"Se connecter avec Facebook\");\n i0.ɵɵelementEnd()()()();\n i0.ɵɵelementStart(21, \"div\", 12)(22, \"div\", 13);\n i0.ɵɵelement(23, \"hr\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(24, \"div\", 14)(25, \"p\");\n i0.ɵɵtext(26, \"ou\");\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(27, \"div\", 13);\n i0.ɵɵelement(28, \"hr\");\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(29, \"div\", 1)(30, \"mat-form-field\", 15);\n i0.ɵɵelement(31, \"input\", 16);\n i0.ɵɵtemplate(32, LoginComponent_mat_error_32_Template, 2, 1, \"mat-error\", 17);\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(33, \"div\", 1)(34, \"mat-form-field\", 15);\n i0.ɵɵelement(35, \"input\", 18);\n i0.ɵɵelementStart(36, \"mat-icon\", 19);\n i0.ɵɵlistener(\"click\", function LoginComponent_Template_mat_icon_click_36_listener() {\n return ctx.hide = !ctx.hide;\n });\n i0.ɵɵtext(37);\n i0.ɵɵelementEnd();\n i0.ɵɵtemplate(38, LoginComponent_mat_error_38_Template, 2, 1, \"mat-error\", 17);\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(39, \"div\", 20)(40, \"button\", 21);\n i0.ɵɵtext(41, \"Se connecter\");\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(42, \"p\", 20)(43, \"a\", 22);\n i0.ɵɵtext(44, \" Mot de passe oubli\\u00E9 ? \");\n i0.ɵɵelementEnd()();\n i0.ɵɵelementStart(45, \"p\", 1);\n i0.ɵɵtext(46, \"Vous n'avez pas encore de compte?\");\n i0.ɵɵelementStart(47, \"a\", 23);\n i0.ɵɵtext(48, \"\\nCr\\u00E9er un compte\\n\");\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(27);\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 styles: [\".navtop[_ngcontent-%COMP%]{margin-top:7em;margin-bottom:3em}.facebooklogin[_ngcontent-%COMP%], .googlelogin[_ngcontent-%COMP%]{margin-bottom:-.5em!important}.marginButton[_ngcontent-%COMP%]{margin-bottom:0!important}\"]\n });\n }\n return LoginComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
|