[Captcha] Implement captcha for 2fa (#1390)

* [Captcha] Implement captcha for 2fa

* Update jslib

* Added remaining items necessary for captcha // updated login to match 2fa style
This commit is contained in:
Vincent Salucci 2022-03-03 18:20:29 -06:00 committed by GitHub
parent edc5245173
commit e84be59075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View File

@ -65,12 +65,15 @@
</a>
</div>
</div>
<div class="box-content-row" [hidden]="!showCaptcha()">
</div>
</div>
<div class="box last" [hidden]="!showCaptcha()">
<div class="box-content">
<div class="box-content-row">
<iframe id="hcaptcha_iframe" height="80"></iframe>
</div>
</div>
</div>
<div class="buttons with-rows">
<div class="buttons-row">
<button type="submit" class="btn primary block" [disabled]="form.loading" appBlurClick>

View File

@ -5,7 +5,7 @@
[appApiAction]="formPromise"
attr.aria-hidden="{{ showingModal }}"
>
<div class="content">
<div id="content" class="content">
<h1>{{ title }}</h1>
<p *ngIf="selectedProviderType === providerType.Authenticator">
{{ "enterVerificationCodeApp" | i18n }}
@ -100,6 +100,13 @@
</div>
</div>
</div>
<div class="box last" [hidden]="!showCaptcha()">
<div class="box-content">
<div class="box-content-row">
<iframe id="hcaptcha_iframe" height="80"></iframe>
</div>
</div>
</div>
<div class="buttons">
<button
type="submit"

View File

@ -80,4 +80,12 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
modal.close();
});
}
async submit() {
await super.submit();
if (this.captchaSiteKey) {
const content = document.getElementById("content") as HTMLDivElement;
content.setAttribute("style", "width:335px");
}
}
}