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2B,kBAE3BA,CADY,yBAEVA,MAAA,UACFA,QACAA,MAAA,eAQAA,MAAA,4BAAoBA,MAAA,0BAASmE,EAAAjB,gBAAgB,GAC3ClD,MAAA,WAKNA,YACAA,MAAA,GAAAqE,EAAA,cAIFrE,QAGEA,MADF,YACEA,CADoE,WAElEA,MAAA,4BAEJA,UACAA,MAAA,aACEA,MAAA,kBASNA,YACAA,MAAA,wBAnEIA,cAAA,YAAAmE,EAAAvD,MAkBQZ,MAAA,GAAAA,MAAA,cAAAmE,EAAArD,MAAA,KAAAqD,EAAArD,MAAAwD,UAAAH,EAAAxD,WAiBAX,MAAA,GAAAA,MAAA,OAAAmE,EAAAzD,YAAA,qBAMEV,MAAA,GAAAA,MAAA,UAAAmE,EAAAzD,YAAA,yBAIFV,cAAA,cAAAmE,EAAAlD,MAAA,KAAAkD,EAAAlD,MAAAqD,UAAAH,EAAAxD,2BCnBR4D,KAAYC,UACZC,KAAeC,KACfC,KACAC,KAAWxB,oBACXyB,KACAC,KACAC,KAAmB3B,UACnB4B,KAAWC,KACXC,KAAY3B,KACZ4B,KACAC,KACAC,KAAsBC,OAAA,snBAGbrF,CAAc","names":["RecaptchaService","constructor","this","siteKey","loadScript","Promise","resolve","reject","window","grecaptcha","script","document","createElement","src","async","defer","onload","onerror","body","appendChild","execute","action","_this","_asyncToGenerator","ready","then","token","catch","error","factory","ɵfac","providedIn","i0","LoginComponent","fb","messageService","authService","router","route","loadingService","recaptchaService","title","senhaToggle","submitted","form","group","login","Validators","required","senha","tokenRecaptcha","recaptchaValid","ngOnInit","clearSession","queryParams","subscribe","param","hasOwnProperty","setValue","setTimeout","add","severity","sticky","summary","detail","hashAutorizacao","close","clear","controls","submit","executarReCaptcha","valid","userAuht","value","response","lastValueFrom","mensagem","length","indSetupInicialConcluido","navigate","idSetupInicialEtapa","ngOnDestroy","togglePassword","_this2","i1","i2","i3","i4","i5","i6","selectors","inputs","standalone","features","decls","vars","consts","template","rf","ctx","LoginComponent_div_8_Template","LoginComponent_div_17_Template","invalid","CommonModule","i7","InputTextModule","i8","CheckboxModule","FormsModule","Button","SharedModule","ReactiveFormsModule","ToastModule","i9","RouterModule","InputGroup","InputGroupAddon","TemplateLoginComponent","styles"],"ignoreList":[],"sourceRoot":"webpack:///","sources":["./src/app/core/services/recaptchaV3/recaptcha.service.ts","./src/app/pages/login/login.component.html","./src/app/pages/login/login.component.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class RecaptchaService {\n readonly siteKey = '6Ldc4X4qAAAAAKoHPBsLfzZewkqD94N_EUTfnldn';\n\n private loadScript(): Promise {\n return new Promise((resolve, reject) => {\n if ((window as any).grecaptcha) {\n resolve();\n return;\n }\n\n const script = document.createElement('script');\n script.src = `https://www.google.com/recaptcha/api.js?render=${this.siteKey}`;\n script.async = true;\n script.defer = true;\n script.onload = () => resolve();\n script.onerror = () => reject('Falha ao carregar o reCAPTCHA');\n document.body.appendChild(script);\n });\n }\n\n async execute(action: string): Promise {\n await this.loadScript();\n\n return new Promise((resolve, reject) => {\n if (!(window as any).grecaptcha) {\n reject('reCAPTCHA não carregado');\n return;\n }\n\n (window as any).grecaptcha.ready(() => {\n (window as any).grecaptcha\n .execute(this.siteKey, { action })\n .then((token: string) => {\n resolve(token);\n })\n .catch((error: any) => {\n reject(error);\n });\n });\n });\n }\n}\n","\n \n
\n
\n \n \n \n \n \n \n
\n
\n \n Por favor, informe um usuário\n
\n
\n\n
\n
\n \n \n \n \n \n \n \n \n \n
\n
\n \n Por favor, informe uma senha\n
\n
\n\n \n
\n \n
\n \n
\n\n","import { UserAuth } from '@core/models/entities/user/userAuth';\nimport { AuthService } from '@core/services/auth/auth.service';\nimport { LoadingService } from '@core/services/loading/loading.service';\nimport { RecaptchaService } from '@core/services/recaptchaV3/recaptcha.service';\nimport { TemplateLoginComponent } from '@shared/components/template-login/template-login.component';\nimport { MessageService, SharedModule } from 'primeng/api';\nimport { Button } from 'primeng/button';\nimport { CheckboxModule } from 'primeng/checkbox';\nimport { InputGroup } from 'primeng/inputgroup';\nimport { InputGroupAddon } from 'primeng/inputgroupaddon';\nimport { InputTextModule } from 'primeng/inputtext';\nimport { ToastModule } from 'primeng/toast';\n\nimport { CommonModule } from '@angular/common';\nimport { Component, Input, OnDestroy, OnInit } from '@angular/core';\nimport {\n FormBuilder,\n FormsModule,\n ReactiveFormsModule,\n Validators\n} from '@angular/forms';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\n\nimport { lastValueFrom } from 'rxjs';\n\n@Component({\n selector: 'app-login',\n templateUrl: './login.component.html',\n styleUrls: ['./login.component.scss'],\n standalone: true,\n imports: [\n CommonModule,\n InputTextModule,\n CheckboxModule,\n FormsModule,\n Button,\n SharedModule,\n ReactiveFormsModule,\n ToastModule,\n RouterModule,\n InputGroup,\n InputGroupAddon,\n TemplateLoginComponent\n ]\n})\nexport class LoginComponent implements OnInit, OnDestroy {\n @Input() title = '';\n senhaToggle = false;\n submitted = false;\n form = this.fb.group({\n login: ['', [Validators.required]],\n senha: ['', [Validators.required]],\n tokenRecaptcha: ['']\n });\n hashAutorizacao: string;\n recaptchaValid = false;\n\n constructor(\n private fb: FormBuilder,\n private messageService: MessageService,\n private authService: AuthService,\n private router: Router,\n private route: ActivatedRoute,\n private loadingService: LoadingService,\n private recaptchaService: RecaptchaService\n ) {}\n\n ngOnInit() {\n this.clearSession();\n this.route.queryParams.subscribe(param => {\n if (param.hasOwnProperty('login')) {\n this.login.setValue(param['login']);\n }\n if (param.hasOwnProperty('tokenExpired')) {\n setTimeout(() => {\n this.messageService.add({\n severity: 'warn',\n sticky: true,\n summary: 'Alerta',\n detail: 'Sua sessão expirou, faça o login novamente.'\n });\n }, 1000);\n }\n\n if (param.hasOwnProperty('hashAutorizacao')) {\n this.hashAutorizacao = param['hashAutorizacao'];\n }\n });\n }\n\n clearSession() {\n this.loadingService.close();\n this.messageService.clear();\n }\n\n get login() {\n return this.form.controls['login'];\n }\n\n get senha() {\n return this.form.controls['senha'];\n }\n\n async submit() {\n await this.executarReCaptcha();\n this.messageService.clear();\n const { login, senha } = this.form.controls;\n if (this.form.valid) {\n if (this.recaptchaValid) {\n const userAuht = this.form.value as UserAuth;\n const response = await lastValueFrom(this.authService.login(userAuht));\n if (response?.error?.mensagem?.length) {\n this.messageService.add({\n sticky: true,\n severity: 'error',\n summary: 'Erro',\n detail: response?.error?.mensagem\n });\n this.recaptchaValid = false;\n } else {\n if (response?.indSetupInicialConcluido) {\n if (this.hashAutorizacao) {\n await this.router.navigate(['inicio'], {\n queryParams: {\n hashAutorizacao: this.hashAutorizacao\n }\n });\n } else {\n await this.router.navigate(['inicio']);\n }\n } else {\n if (response?.idSetupInicialEtapa) {\n this.router.navigate(['passo-a-passo-setup']);\n } else {\n this.router.navigate(['pagina-inicial-setup']);\n }\n }\n }\n } else {\n this.messageService.add({\n sticky: true,\n severity: 'error',\n summary: 'Preencha todos os campos',\n detail: 'Por favor, marque o recaptcha.'\n });\n }\n } else {\n if (!login.value) {\n this.messageService.add({\n severity: 'error',\n sticky: true,\n summary: 'Preencha todos os campos',\n detail: 'Por favor, informe um usuário.'\n });\n }\n\n if (!senha.value) {\n this.messageService.add({\n severity: 'error',\n sticky: true,\n summary: 'Preencha todos os campos',\n detail: 'Por favor, informe uma senha.'\n });\n }\n }\n }\n\n ngOnDestroy() {\n this.messageService.clear();\n }\n\n togglePassword() {\n this.senhaToggle = !this.senhaToggle;\n }\n\n async executarReCaptcha() {\n const token = await this.recaptchaService.execute('login');\n this.form.controls['tokenRecaptcha'].setValue(token);\n this.recaptchaValid = true;\n }\n}\n"],"x_google_ignoreList":[]}