Add provider info
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2024-02-08 18:33:35 +01:00
parent 3bacb8a5d9
commit 3e482470b6
2 changed files with 11 additions and 5 deletions

View File

@ -5,6 +5,9 @@
<div class="card" *ngIf="user"> <div class="card" *ngIf="user">
<div class="card-body"> <div class="card-body">
<div class="username">{{user.name}}</div> <div class="username">{{user.name}}</div>
<div *ngIf="getProvider(); let provider">
<small><span i18n>Provider</span><span> </span><span>{{provider}}</span></small>
</div>
<div><a href="#" (click)="logout($event)" i18n>logout</a></div> <div><a href="#" (click)="logout($event)" i18n>logout</a></div>
</div> </div>
</div> </div>

View File

@ -20,11 +20,14 @@ export class UserMenuComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
} }
getLetter():string { getProvider():string | null {
if (this.user && this.user.firstName && this.user.lastName) const ownedClaims = this.oauthService.getIdentityClaims();
return this.user.firstName.substr(0,1).toUpperCase() + if(ownedClaims) {
this.user.lastName.substr(0,1).toUpperCase(); if (ownedClaims["idp"] != "local") {
return this.user && this.user.name ? this.user.name.substr(0,1).toUpperCase():""; return ownedClaims["idp"];
}
}
return null;
} }
logout(event:MouseEvent) { logout(event:MouseEvent) {