Skip to content

Commit

Permalink
Merge pull request #1822 from thebiggive/DON-998-login-captcha
Browse files Browse the repository at this point in the history
DON-998 – standalone login page: skip captcha in Regression to allow automated testing
  • Loading branch information
NoelLH authored Jan 10, 2025
2 parents bef5277 + e47511d commit 637de53
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/app/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,23 @@ export class LoginComponent implements OnInit, AfterViewInit, OnDestroy{
this.pageInitialised = true;
}

private friendlyCaptchaWiget: WidgetInstance;
private friendlyCaptchaWidget: WidgetInstance;

async ngAfterViewInit() {
if (! isPlatformBrowser(this.platformId)) {
return
}

if (environment.environmentId === 'regression') {
this.captchaCode = 'dummy-captcha-code';
return;
}

if (! this.friendlyCaptcha) {
return;
}

this.friendlyCaptchaWiget = new WidgetInstance(this.friendlyCaptcha.nativeElement, {
this.friendlyCaptchaWidget = new WidgetInstance(this.friendlyCaptcha.nativeElement, {
doneCallback: (solution) => {
this.captchaCode = solution;
},
Expand All @@ -133,7 +138,7 @@ export class LoginComponent implements OnInit, AfterViewInit, OnDestroy{
},
});

await this.friendlyCaptchaWiget.start()
await this.friendlyCaptchaWidget.start()
}


Expand Down Expand Up @@ -183,8 +188,8 @@ export class LoginComponent implements OnInit, AfterViewInit, OnDestroy{
this.loggingIn = false;

this.captchaCode = undefined;
this.friendlyCaptchaWiget.reset();
await this.friendlyCaptchaWiget.start();
this.friendlyCaptchaWidget.reset();
await this.friendlyCaptchaWidget.start();
}
});
this.loggingIn = true;
Expand Down

0 comments on commit 637de53

Please sign in to comment.