{"ast":null,"code":"import { FormGroup, FormControl, Validators } from '@angular/forms';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"src/app/shared/services/authentication.service\";\nimport * as i2 from \"@angular/router\";\nimport * as i3 from \"@angular/common\";\nimport * as i4 from \"@angular/material/icon\";\nimport * as i5 from \"@angular/material/card\";\nimport * as i6 from \"@angular/material/input\";\nimport * as i7 from \"@angular/material/form-field\";\nimport * as i8 from \"@angular/material/button\";\nimport * as i9 from \"@angular/forms\";\nconst _c0 = () => [\"/authentication/forgot-password\"];\nfunction AppSideLoginComponent_div_8_Template(rf, ctx) {\n  if (rf & 1) {\n    i0.ɵɵelementStart(0, \"div\")(1, \"mat-error\");\n    i0.ɵɵtext(2);\n    i0.ɵɵelementEnd()();\n  }\n  if (rf & 2) {\n    const ctx_r0 = i0.ɵɵnextContext();\n    i0.ɵɵadvance(2);\n    i0.ɵɵtextInterpolate(ctx_r0.errorMessage);\n  }\n}\nexport class AppSideLoginComponent {\n  constructor(authService, router, route) {\n    this.authService = authService;\n    this.router = router;\n    this.route = route;\n    this.errorMessage = '';\n    this.hidePassword = true;\n    this.validateControl = controlName => {\n      return this.loginForm.get(controlName).invalid && this.loginForm.get(controlName).touched;\n    };\n    this.hasError = (controlName, errorName) => {\n      return this.loginForm.get(controlName).hasError(errorName);\n    };\n    this.loginUser = loginFormValue => {\n      this.showError = false;\n      const login = {\n        ...loginFormValue\n      };\n      const userForAuth = {\n        email: login.username,\n        password: login.password,\n        clientURI: 'http://localhost:4200/authentication/forgotpassword'\n      };\n      this.authService.loginUser('api/accounts/login', userForAuth).subscribe({\n        next: res => {\n          localStorage.setItem(\"token\", res.token);\n          this.authService.sendAuthStateChangeNotification(res.isAuthSuccessful);\n          this.router.navigate([this.returnUrl]);\n        },\n        error: err => {\n          this.errorMessage = err.message;\n          this.showError = true;\n        }\n      });\n    };\n  }\n  ngOnInit() {\n    this.loginForm = new FormGroup({\n      username: new FormControl(\"\", [Validators.required]),\n      password: new FormControl(\"\", [Validators.required])\n    });\n    this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';\n  }\n  togglePasswordVisibility() {\n    this.hidePassword = !this.hidePassword;\n  }\n  static #_ = this.ɵfac = function AppSideLoginComponent_Factory(t) {\n    return new (t || AppSideLoginComponent)(i0.ɵɵdirectiveInject(i1.AuthenticationService), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(i2.ActivatedRoute));\n  };\n  static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n    type: AppSideLoginComponent,\n    selectors: [[\"app-login\"]],\n    decls: 29,\n    vars: 7,\n    consts: [[1, \"blank-layout-container\", \"justify-content-center\", \"align-items-center\", \"bg-light-primary\"], [1, \"position-relative\", \"row\", \"w-100\", \"h-100\", \"bg-gredient\", \"justify-content-center\"], [1, \"col-lg-4\", \"d-flex\", \"align-items-center\"], [1, \"cardWithShadow\", \"boxed-auth\"], [1, \"p-32\"], [1, \"text-center\"], [\"src\", \"../../../../assets/images/logos/logo-sub.png\", \"alt\", \"logo\", 1, \"align-middle\", \"m-2\"], [4, \"ngIf\"], [\"autocomplete\", \"off\", \"novalidate\", \"\", 1, \"m-t-30\", 3, \"ngSubmit\", \"formGroup\"], [1, \"mat-subtitle-2\", \"f-s-14\", \"f-w-600\", \"m-b-12\", \"d-block\"], [\"appearance\", \"outline\", \"color\", \"primary\", 1, \"w-100\"], [\"matInput\", \"\", \"type\", \"text\", \"id\", \"username\", \"formControlName\", \"username\", 1, \"form-control\"], [\"appearance\", \"outline\", \"color\", \"primary\", 1, \"w-100\", \"position-relative\"], [1, \"password-container\"], [\"matInput\", \"\", \"id\", \"password\", \"formControlName\", \"password\", 1, \"form-control\", 3, \"type\"], [1, \"password-toggle-button\", 3, \"click\"], [1, \"d-flex\", \"align-items-center\", \"m-b-12\"], [1, \"text-primary\", \"f-w-600\", \"text-decoration-none\", \"m-l-auto\", \"f-s-14\", 3, \"routerLink\"], [\"mat-flat-button\", \"\", \"color\", \"primary\", \"type\", \"submit\", 1, \"w-100\", 3, \"disabled\"]],\n    template: function AppSideLoginComponent_Template(rf, ctx) {\n      if (rf & 1) {\n        i0.ɵɵelementStart(0, \"div\", 0)(1, \"div\", 1)(2, \"div\", 2)(3, \"mat-card\", 3)(4, \"mat-card-content\", 4)(5, \"div\", 5)(6, \"a\");\n        i0.ɵɵelement(7, \"img\", 6);\n        i0.ɵɵelementEnd()();\n        i0.ɵɵtemplate(8, AppSideLoginComponent_div_8_Template, 3, 1, \"div\", 7);\n        i0.ɵɵelementStart(9, \"mat-card-title\");\n        i0.ɵɵtext(10, \"Giri\\u015F\");\n        i0.ɵɵelementEnd();\n        i0.ɵɵelementStart(11, \"form\", 8);\n        i0.ɵɵlistener(\"ngSubmit\", function AppSideLoginComponent_Template_form_ngSubmit_11_listener() {\n          return ctx.loginUser(ctx.loginForm.value);\n        });\n        i0.ɵɵelementStart(12, \"mat-label\", 9);\n        i0.ɵɵtext(13, \"Email\");\n        i0.ɵɵelementEnd();\n        i0.ɵɵelementStart(14, \"mat-form-field\", 10);\n        i0.ɵɵelement(15, \"input\", 11);\n        i0.ɵɵelementEnd();\n        i0.ɵɵelementStart(16, \"mat-label\", 9);\n        i0.ɵɵtext(17, \"\\u015Eifre\");\n        i0.ɵɵelementEnd();\n        i0.ɵɵelementStart(18, \"mat-form-field\", 12)(19, \"div\", 13);\n        i0.ɵɵelement(20, \"input\", 14);\n        i0.ɵɵelementStart(21, \"div\", 15);\n        i0.ɵɵlistener(\"click\", function AppSideLoginComponent_Template_div_click_21_listener() {\n          return ctx.togglePasswordVisibility();\n        });\n        i0.ɵɵelementStart(22, \"mat-icon\");\n        i0.ɵɵtext(23);\n        i0.ɵɵelementEnd()()()();\n        i0.ɵɵelementStart(24, \"div\", 16)(25, \"a\", 17);\n        i0.ɵɵtext(26, \"Parolan\\u0131z\\u0131 m\\u0131 unuttunuz?\");\n        i0.ɵɵelementEnd()();\n        i0.ɵɵelementStart(27, \"button\", 18);\n        i0.ɵɵtext(28, \" Giri\\u015F \");\n        i0.ɵɵelementEnd()()()()()()();\n      }\n      if (rf & 2) {\n        i0.ɵɵadvance(8);\n        i0.ɵɵproperty(\"ngIf\", ctx.showError);\n        i0.ɵɵadvance(3);\n        i0.ɵɵproperty(\"formGroup\", ctx.loginForm);\n        i0.ɵɵadvance(9);\n        i0.ɵɵproperty(\"type\", ctx.hidePassword ? \"password\" : \"text\");\n        i0.ɵɵadvance(3);\n        i0.ɵɵtextInterpolate(ctx.hidePassword ? \"visibility_off\" : \"visibility\");\n        i0.ɵɵadvance(2);\n        i0.ɵɵproperty(\"routerLink\", i0.ɵɵpureFunction0(6, _c0));\n        i0.ɵɵadvance(2);\n        i0.ɵɵproperty(\"disabled\", !ctx.loginForm.valid);\n      }\n    },\n    dependencies: [i3.NgIf, i2.RouterLink, i4.MatIcon, i5.MatCard, i5.MatCardContent, i5.MatCardTitle, i6.MatInput, i7.MatFormField, i7.MatLabel, i7.MatError, i8.MatButton, i9.ɵNgNoValidate, i9.DefaultValueAccessor, i9.NgControlStatus, i9.NgControlStatusGroup, i9.FormGroupDirective, i9.FormControlName],\n    encapsulation: 2\n  });\n}","map":{"version":3,"names":["FormGroup","FormControl","Validators","i0","ɵɵelementStart","ɵɵtext","ɵɵelementEnd","ɵɵadvance","ɵɵtextInterpolate","ctx_r0","errorMessage","AppSideLoginComponent","constructor","authService","router","route","hidePassword","validateControl","controlName","loginForm","get","invalid","touched","hasError","errorName","loginUser","loginFormValue","showError","login","userForAuth","email","username","password","clientURI","subscribe","next","res","localStorage","setItem","token","sendAuthStateChangeNotification","isAuthSuccessful","navigate","returnUrl","error","err","message","ngOnInit","required","snapshot","queryParams","togglePasswordVisibility","_","ɵɵdirectiveInject","i1","AuthenticationService","i2","Router","ActivatedRoute","_2","selectors","decls","vars","consts","template","AppSideLoginComponent_Template","rf","ctx","ɵɵelement","ɵɵtemplate","AppSideLoginComponent_div_8_Template","ɵɵlistener","AppSideLoginComponent_Template_form_ngSubmit_11_listener","value","AppSideLoginComponent_Template_div_click_21_listener","ɵɵproperty","ɵɵpureFunction0","_c0","valid"],"sources":["C:\\Users\\Cem\\Desktop\\InventryUI-Client\\src\\app\\pages\\authentication\\login\\login.component.ts","C:\\Users\\Cem\\Desktop\\InventryUI-Client\\src\\app\\pages\\authentication\\login\\login.component.html"],"sourcesContent":["import { HttpErrorResponse } from '@angular/common/http';\nimport { Component } from '@angular/core';\nimport { FormGroup, FormControl, Validators } from '@angular/forms';\nimport { Router, ActivatedRoute } from '@angular/router';\nimport { AuthResponseDto } from 'src/app/_interface/response/authResponseDto.model';\nimport { UserForAuthenticationDto } from 'src/app/_interface/user/userForAuthenticationDto.model';\nimport { AuthenticationService } from 'src/app/shared/services/authentication.service';\n\n\n@Component({\n  selector: 'app-login',\n  templateUrl: './login.component.html',\n})\nexport class AppSideLoginComponent {\n  private returnUrl: string;\n\n  loginForm: FormGroup | any;\n  errorMessage: string = '';\n  showError: boolean;\n  hidePassword = true;\n\n  constructor(private authService: AuthenticationService, private router: Router, private route: ActivatedRoute) { }\n\n  ngOnInit(): void {\n    this.loginForm = new FormGroup({\n      username: new FormControl(\"\", [Validators.required]),\n      password: new FormControl(\"\", [Validators.required])\n    })\n    this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';\n  }\n\n  togglePasswordVisibility() {\n    this.hidePassword = !this.hidePassword;\n  }\n\n  validateControl = (controlName: string) => {\n    return this.loginForm.get(controlName).invalid && this.loginForm.get(controlName).touched\n  }\n\n  hasError = (controlName: string, errorName: string) => {\n    return this.loginForm.get(controlName).hasError(errorName)\n  }\n\n  loginUser = (loginFormValue:any) => {\n    this.showError = false;\n    const login = { ...loginFormValue };\n\n    const userForAuth: UserForAuthenticationDto = {\n      email: login.username,\n      password: login.password,\n      clientURI: 'http://localhost:4200/authentication/forgotpassword'\n    }\n\n    this.authService.loginUser('api/accounts/login', userForAuth)\n      .subscribe({\n        next: (res: AuthResponseDto) => {\n            localStorage.setItem(\"token\", res.token);\n            this.authService.sendAuthStateChangeNotification(res.isAuthSuccessful);\n            this.router.navigate([this.returnUrl]);\n          \n        },\n        error: (err: HttpErrorResponse) => {\n          this.errorMessage = err.message;\n          this.showError = true;\n        }\n      })\n  }\n\n}\n","<div class=\"blank-layout-container justify-content-center align-items-center bg-light-primary\">\n  <div class=\"position-relative row w-100 h-100 bg-gredient justify-content-center\">\n    <div class=\"col-lg-4 d-flex align-items-center\">\n      <mat-card class=\"cardWithShadow boxed-auth\">\n        <mat-card-content class=\"p-32\">\n          <div class=\"text-center\">\n            <a>\n              <img src=\"../../../../assets/images/logos/logo-sub.png\" class=\"align-middle m-2\" alt=\"logo\" />\n            </a>\n          </div>\n\n          <div *ngIf=\"showError\">\n            <mat-error>{{errorMessage}}</mat-error>\n          </div>\n          <mat-card-title>Giriş</mat-card-title>\n          <form class=\"m-t-30\" [formGroup]=\"loginForm\" autocomplete=\"off\" novalidate\n            (ngSubmit)=\"loginUser(loginForm.value)\">\n\n            <mat-label class=\"mat-subtitle-2 f-s-14 f-w-600 m-b-12 d-block\">Email</mat-label>\n            <mat-form-field appearance=\"outline\" class=\"w-100\" color=\"primary\">\n              <input matInput type=\"text\" id=\"username\" formControlName=\"username\" class=\"form-control\" />\n            </mat-form-field>\n\n            <mat-label class=\"mat-subtitle-2 f-s-14 f-w-600 m-b-12 d-block\">Şifre</mat-label>\n            <mat-form-field appearance=\"outline\" class=\"w-100 position-relative\" color=\"primary\">\n              <div class=\"password-container\">\n                <input matInput [type]=\"hidePassword ? 'password' : 'text'\" id=\"password\" formControlName=\"password\"\n                  class=\"form-control\" />\n                <div class=\"password-toggle-button\" (click)=\"togglePasswordVisibility()\">\n                  <mat-icon>{{hidePassword ? 'visibility_off' : 'visibility'}}</mat-icon>\n                </div>\n              </div>\n            </mat-form-field>\n\n            <div class=\"d-flex align-items-center m-b-12\">\n              <a [routerLink]=\"['/authentication/forgot-password']\"\n                class=\"text-primary f-w-600 text-decoration-none m-l-auto f-s-14\">Parolanızı mı unuttunuz?</a>\n            </div>\n\n            <button mat-flat-button color=\"primary\" class=\"w-100\" type=\"submit\" [disabled]=\"!loginForm.valid\">\n              Giriş\n            </button>\n          </form>\n        </mat-card-content>\n      </mat-card>\n    </div>\n  </div>\n</div>\n"],"mappings":"AAEA,SAASA,SAAS,EAAEC,WAAW,EAAEC,UAAU,QAAQ,gBAAgB;;;;;;;;;;;;;;ICUvDC,EADF,CAAAC,cAAA,UAAuB,gBACV;IAAAD,EAAA,CAAAE,MAAA,GAAgB;IAC7BF,EAD6B,CAAAG,YAAA,EAAY,EACnC;;;;IADOH,EAAA,CAAAI,SAAA,GAAgB;IAAhBJ,EAAA,CAAAK,iBAAA,CAAAC,MAAA,CAAAC,YAAA,CAAgB;;;ADCvC,OAAM,MAAOC,qBAAqB;EAQhCC,YAAoBC,WAAkC,EAAUC,MAAc,EAAUC,KAAqB;IAAzF,KAAAF,WAAW,GAAXA,WAAW;IAAiC,KAAAC,MAAM,GAANA,MAAM;IAAkB,KAAAC,KAAK,GAALA,KAAK;IAJ7F,KAAAL,YAAY,GAAW,EAAE;IAEzB,KAAAM,YAAY,GAAG,IAAI;IAgBnB,KAAAC,eAAe,GAAIC,WAAmB,IAAI;MACxC,OAAO,IAAI,CAACC,SAAS,CAACC,GAAG,CAACF,WAAW,CAAC,CAACG,OAAO,IAAI,IAAI,CAACF,SAAS,CAACC,GAAG,CAACF,WAAW,CAAC,CAACI,OAAO;IAC3F,CAAC;IAED,KAAAC,QAAQ,GAAG,CAACL,WAAmB,EAAEM,SAAiB,KAAI;MACpD,OAAO,IAAI,CAACL,SAAS,CAACC,GAAG,CAACF,WAAW,CAAC,CAACK,QAAQ,CAACC,SAAS,CAAC;IAC5D,CAAC;IAED,KAAAC,SAAS,GAAIC,cAAkB,IAAI;MACjC,IAAI,CAACC,SAAS,GAAG,KAAK;MACtB,MAAMC,KAAK,GAAG;QAAE,GAAGF;MAAc,CAAE;MAEnC,MAAMG,WAAW,GAA6B;QAC5CC,KAAK,EAAEF,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