1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00
Files
browser/src/app/accounts/register.component.ts
Matt Gibson c863d68057 Feature/use hcaptcha if bot (#1000)
* Add captcha to login component

* Add catpcha to login page

* Update content width if captcha is visible

* extend submit to handle widening if captcha is required

* Improve login styling

* Add Captcha to registration page

* Remove padding from captcha div

The padding was messing up image selection of captcha items

* Update jslib

* PR review

* update jslib
2021-07-23 13:48:10 -05:00

62 lines
2.3 KiB
TypeScript

import {
Component,
NgZone,
OnDestroy,
OnInit,
} from '@angular/core';
import { Router } from '@angular/router';
import { ApiService } from 'jslib-common/abstractions/api.service';
import { AuthService } from 'jslib-common/abstractions/auth.service';
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { StateService } from 'jslib-common/abstractions/state.service';
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
import { RegisterComponent as BaseRegisterComponent } from 'jslib-angular/components/register.component';
const BroadcasterSubscriptionId = 'RegisterComponent';
@Component({
selector: 'app-register',
templateUrl: 'register.component.html',
})
export class RegisterComponent extends BaseRegisterComponent implements OnInit, OnDestroy {
constructor(authService: AuthService, router: Router,
i18nService: I18nService, cryptoService: CryptoService,
apiService: ApiService, stateService: StateService,
platformUtilsService: PlatformUtilsService, passwordGenerationService: PasswordGenerationService,
environmentService: EnvironmentService, private broadcasterService: BroadcasterService,
private ngZone: NgZone) {
super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService,
passwordGenerationService, environmentService);
}
async ngOnInit() {
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
this.ngZone.run(() => {
switch (message.command) {
case 'windowHidden':
this.onWindowHidden();
break;
default:
}
});
});
super.ngOnInit();
}
ngOnDestroy() {
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
}
onWindowHidden() {
this.showPassword = false;
}
}