Skip to content

Commit 9d4e1c1

Browse files
feat: add option to hide connected user panel
1 parent b768cdc commit 9d4e1c1

File tree

4 files changed

+29
-19
lines changed

4 files changed

+29
-19
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
build:
88
docker:
99
# specify the version you desire here
10-
- image: circleci/node:8.9.4
10+
- image: circleci/node:12
1111

1212
# Specify service dependencies here if necessary
1313
# CircleCI maintains a library of pre-built images

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
11
1+
12

projects/ngx-auth-firebaseui/src/lib/components/ngx-auth-firebaseui/auth.component.html

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- we arrived from the guard after trying to access a protected route even though we are connected
66
-->
77
<div
8-
*ngIf="(config.guardProtectedRoutesUntilEmailIsVerified && !user.emailVerified) || (authProcess.emailConfirmationSent && !user.emailVerified); else signedInUser"
8+
*ngIf="isEmailConfirmationScreenVisible(user)"
99
fxLayout="row" fxLayoutAlign="center center">
1010
<ngx-auth-firebaseui-email-confirmation
1111
(signOut)="signOut()"
@@ -21,23 +21,21 @@
2121
</ngx-auth-firebaseui-email-confirmation>
2222
</div>
2323

24-
<ng-template #signedInUser>
25-
<div class="signed-in-container" fxLayout="column" fxLayoutAlign="center center">
26-
<img *ngIf="user?.photoURL; else noPhoto" [src]="user?.photoURL" class="account-circle">
27-
<ng-template #noPhoto>
28-
<mat-icon class="account-circle">account_circle</mat-icon>
29-
</ng-template>
30-
<div class="user-display-name mat-title">{{ user?.displayName }}</div>
31-
<div class="user-email mat-body-2">{{ user?.email }}</div>
32-
<div class="actions">
33-
<mat-progress-bar *ngIf="isLoading" mode="indeterminate"></mat-progress-bar>
34-
<a [routerLink]="goBackURL" class="go-back-button action-button" color="primary"
35-
mat-stroked-button>{{ verifyEmailGoBackText }}</a>
36-
<button (click)="signOut()" class="sign-out-button action-button" color="warn"
37-
mat-stroked-button>{{ signOutText }}</button>
38-
</div>
24+
<div *ngIf="isUserProfileScreenVisible(user)" class="signed-in-container" fxLayout="column" fxLayoutAlign="center center" *ngIf="">
25+
<img *ngIf="user?.photoURL; else noPhoto" [src]="user?.photoURL" class="account-circle">
26+
<ng-template #noPhoto>
27+
<mat-icon class="account-circle">account_circle</mat-icon>
28+
</ng-template>
29+
<div class="user-display-name mat-title">{{ user?.displayName }}</div>
30+
<div class="user-email mat-body-2">{{ user?.email }}</div>
31+
<div class="actions">
32+
<mat-progress-bar *ngIf="isLoading" mode="indeterminate"></mat-progress-bar>
33+
<a [routerLink]="goBackURL" class="go-back-button action-button" color="primary"
34+
mat-stroked-button>{{ verifyEmailGoBackText }}</a>
35+
<button (click)="signOut()" class="sign-out-button action-button" color="warn"
36+
mat-stroked-button>{{ signOutText }}</button>
3937
</div>
40-
</ng-template>
38+
</div>
4139

4240
</ng-container>
4341

projects/ngx-auth-firebaseui/src/lib/components/ngx-auth-firebaseui/auth.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export class AuthComponent implements OnInit, AfterViewInit, OnChanges, OnDestro
7171
@Input() tabIndex: number | null;
7272
@Input() registrationEnabled = true;
7373
@Input() resetPasswordEnabled = true;
74+
@Input() connectedUserScreenEnabled = true;
7475
@Input() guestEnabled = true;
7576
@Input() tosUrl: string;
7677
@Input() privacyPolicyUrl: string;
@@ -192,6 +193,15 @@ export class AuthComponent implements OnInit, AfterViewInit, OnChanges, OnDestro
192193
return this.authenticationError ? 'warn' : 'primary';
193194
}
194195

196+
public isEmailConfirmationScreenVisible(user: firebase.User): boolean {
197+
return (this.config.guardProtectedRoutesUntilEmailIsVerified && !user.emailVerified)
198+
|| (this.authProcess.emailConfirmationSent && !user.emailVerified);
199+
}
200+
201+
public isUserProfileScreenVisible(user: firebase.User): boolean {
202+
return !this.isEmailConfirmationScreenVisible(user) && this.connectedUserScreenEnabled;
203+
}
204+
195205
public ngOnInit(): void {
196206
if (isPlatformBrowser(this.platformId)) {
197207
this.onErrorSubscription = this.onError.subscribe(() => this.authenticationError = true);
@@ -339,6 +349,8 @@ export class AuthComponent implements OnInit, AfterViewInit, OnChanges, OnDestro
339349
});
340350
}
341351

352+
353+
342354
private chooseBackUrl() {
343355
return this.activatedRoute.snapshot.queryParams.redirectUrl || this.goBackURL || '/';
344356
}

0 commit comments

Comments
 (0)