캡차코드 출력
This commit is contained in:
parent
a512fe9b17
commit
4d36bd6ae5
|
@ -81,9 +81,11 @@
|
||||||
<mat-error> 비밀번호를 입력하세요 </mat-error>
|
<mat-error> 비밀번호를 입력하세요 </mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
<img [src]="imagePath" />
|
||||||
<mat-form-field class="w-full">
|
<mat-form-field class="w-full">
|
||||||
<mat-label>보안코드*</mat-label>
|
<mat-label>보안코드*</mat-label>
|
||||||
<input id="email" matInput [formControlName]="'recaptcha'" />
|
<input id="email" matInput [formControlName]="'recaptcha'" />
|
||||||
|
|
||||||
<mat-error *ngIf="signInForm.get('email')?.hasError('required')">
|
<mat-error *ngIf="signInForm.get('email')?.hasError('required')">
|
||||||
보안코드를 입력하세요.
|
보안코드를 입력하세요.
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, NgForm, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, NgForm, Validators } from '@angular/forms';
|
||||||
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
import { fuseAnimations } from '@fuse/animations';
|
||||||
import { FuseAlertType } from '@fuse/components/alert';
|
import { FuseAlertType } from '@fuse/components/alert';
|
||||||
import { AuthService } from 'app/core/auth/auth.service';
|
import { AuthService } from 'app/core/auth/auth.service';
|
||||||
|
import { IdentityService } from 'app/modules/polyglot/member/services/identity.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'auth-sign-in',
|
selector: 'auth-sign-in',
|
||||||
|
@ -20,6 +22,8 @@ export class AuthSignInComponent implements OnInit {
|
||||||
};
|
};
|
||||||
signInForm!: FormGroup;
|
signInForm!: FormGroup;
|
||||||
showAlert: boolean = false;
|
showAlert: boolean = false;
|
||||||
|
captchaToken?: string;
|
||||||
|
imagePath?: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -28,7 +32,9 @@ export class AuthSignInComponent implements OnInit {
|
||||||
private _activatedRoute: ActivatedRoute,
|
private _activatedRoute: ActivatedRoute,
|
||||||
private _authService: AuthService,
|
private _authService: AuthService,
|
||||||
private _formBuilder: FormBuilder,
|
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],
|
password: ['admin', Validators.required],
|
||||||
// recaptcha: ['', 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
|
// @ Public methods
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
__getImagePath(): void {}
|
||||||
/**
|
/**
|
||||||
* Sign in
|
* Sign in
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -52,8 +52,8 @@ export class IdentityService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
captcha(): Promise<boolean> {
|
captcha(): Promise<CaptchaResponse.Result> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Promise<CaptchaResponse.Result>((resolve, reject) => {
|
||||||
let req = new CaptchaRequest();
|
let req = new CaptchaRequest();
|
||||||
|
|
||||||
this.__natsService
|
this.__natsService
|
||||||
|
@ -63,7 +63,7 @@ export class IdentityService {
|
||||||
CaptchaResponse.deserializeBinary
|
CaptchaResponse.deserializeBinary
|
||||||
)
|
)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
console.log('success', result, result.getToken(), result.getImage());
|
resolve(result);
|
||||||
})
|
})
|
||||||
.catch((e: Error) => {
|
.catch((e: Error) => {
|
||||||
console.log('failed', e.getCode(), e.getMessage(), e.getData());
|
console.log('failed', e.getCode(), e.getMessage(), e.getData());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user