Skip to content

Commit

Permalink
Merge pull request #2562 from sam-warren/registration-flow-fix
Browse files Browse the repository at this point in the history
Fix verified registraion flow blocking users from registering
  • Loading branch information
ajdeziel authored Jan 15, 2025
2 parents 24905a8 + 3eaef10 commit 46cf913
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class LoginService {
public async login(targetUrl: string = undefined): Promise<boolean> {
return await this.oauthService.tryLoginImplicitFlow().then(() => {
if (!this.oauthService.hasValidAccessToken()) {
if (this.verifiedRegistrationFlow(targetUrl)) {
if (this.verifiedRegistrationFlow(targetUrl) || this.nonVerifiedRegistrationFlow(targetUrl)) {
this.oauthService.initImplicitFlow(targetUrl);
this.isLoggedIn$.next(false);
return Promise.resolve(false);
Expand Down Expand Up @@ -67,6 +67,16 @@ export class LoginService {
);
}

private nonVerifiedRegistrationFlow(targetUrl: string): boolean {
if (!targetUrl) {
return false;
}

const url = new URL(targetUrl, window.location.origin);

return url.pathname === '/verified-registration' && !url.searchParams.has('inviteId');
}

public async tryLogin(): Promise<void> {
await this.oauthService.tryLogin().then(() => {
if (this.oauthService.hasValidAccessToken()) {
Expand Down

0 comments on commit 46cf913

Please sign in to comment.