From 4d36bd6ae553c3306b05170ec7820d310fb5ee1f Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Fri, 5 Aug 2022 09:29:13 +0000 Subject: [PATCH] =?UTF-8?q?=EC=BA=A1=EC=B0=A8=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/auth/sign-in/sign-in.component.html | 2 ++ .../modules/auth/sign-in/sign-in.component.ts | 16 +++++++++++++++- .../polyglot/member/services/identity.service.ts | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/app/modules/auth/sign-in/sign-in.component.html b/src/app/modules/auth/sign-in/sign-in.component.html index 8173e3a..c5feeb3 100644 --- a/src/app/modules/auth/sign-in/sign-in.component.html +++ b/src/app/modules/auth/sign-in/sign-in.component.html @@ -81,9 +81,11 @@ 비밀번호를 입력하세요 + 보안코드* + 보안코드를 입력하세요. diff --git a/src/app/modules/auth/sign-in/sign-in.component.ts b/src/app/modules/auth/sign-in/sign-in.component.ts index ce4f89a..ecc4ed9 100644 --- a/src/app/modules/auth/sign-in/sign-in.component.ts +++ b/src/app/modules/auth/sign-in/sign-in.component.ts @@ -1,9 +1,11 @@ import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; import { FormBuilder, FormGroup, NgForm, Validators } from '@angular/forms'; +import { DomSanitizer } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; import { fuseAnimations } from '@fuse/animations'; import { FuseAlertType } from '@fuse/components/alert'; import { AuthService } from 'app/core/auth/auth.service'; +import { IdentityService } from 'app/modules/polyglot/member/services/identity.service'; @Component({ selector: 'auth-sign-in', @@ -20,6 +22,8 @@ export class AuthSignInComponent implements OnInit { }; signInForm!: FormGroup; showAlert: boolean = false; + captchaToken?: string; + imagePath?: any; /** * Constructor @@ -28,7 +32,9 @@ export class AuthSignInComponent implements OnInit { private _activatedRoute: ActivatedRoute, private _authService: AuthService, private _formBuilder: FormBuilder, - private _router: Router + private _router: Router, + private _identityService: IdentityService, + private _sanitizer: DomSanitizer ) {} // ----------------------------------------------------------------------------------------------------- @@ -48,12 +54,20 @@ export class AuthSignInComponent implements OnInit { password: ['admin', Validators.required], // recaptcha: ['', Validators.required], }); + this._identityService.captcha().then((result) => { + console.log('success', result, result.getToken(), result.getImage()); + + this.imagePath = this._sanitizer.bypassSecurityTrustResourceUrl( + 'data:image/jpg;base64,' + result.getImage() + ); + }); } // ----------------------------------------------------------------------------------------------------- // @ Public methods // ----------------------------------------------------------------------------------------------------- + __getImagePath(): void {} /** * Sign in */ diff --git a/src/app/modules/polyglot/member/services/identity.service.ts b/src/app/modules/polyglot/member/services/identity.service.ts index 086efa3..dae1c60 100644 --- a/src/app/modules/polyglot/member/services/identity.service.ts +++ b/src/app/modules/polyglot/member/services/identity.service.ts @@ -52,8 +52,8 @@ export class IdentityService { }); } - captcha(): Promise { - return new Promise((resolve, reject) => { + captcha(): Promise { + return new Promise((resolve, reject) => { let req = new CaptchaRequest(); this.__natsService @@ -63,7 +63,7 @@ export class IdentityService { CaptchaResponse.deserializeBinary ) .then((result) => { - console.log('success', result, result.getToken(), result.getImage()); + resolve(result); }) .catch((e: Error) => { console.log('failed', e.getCode(), e.getMessage(), e.getData());