@ -146,11 +176,55 @@ export class GfUserAccountSettingsComponent implements OnInit {
}
}
});
});
addIcons({eyeOffOutline,eyeOutline});
addIcons({eyeOffOutline,eyeOutline,linkOutline});
}
}
publicngOnInit() {
publicngOnInit() {
this.update();
this.update();
// Handle query params for link results
this.activatedRoute.queryParams
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((params)=>{
if(params['linkSuccess']==='true'){
this.snackBar.open(
$localize`Your OIDC account has been successfully linked.`,
undefined,
{duration: ms('5 seconds')}
);
// Refresh user data
this.userService.get(true).subscribe();
}elseif(params['linkError']){
leterrorMessage=$localize`Failed to link OIDC account.`;
switch(params['linkError']){
case'already-linked':
errorMessage=$localize`This OIDC account is already linked to another user.`;
break;
case'invalid-session':
errorMessage=$localize`Your session is invalid. Please log in again.`;
break;
case'invalid-provider':
errorMessage=$localize`Only token-authenticated users can link OIDC.`;
break;
}
this.snackBar.open(errorMessage,undefined,{
duration: ms('5 seconds')
});
}
});
}
publicgetAuthProviderDisplayName():string{
switch(this.user?.provider){
case'ANONYMOUS':
return'Security Token';
case'GOOGLE':
return'Google';
case'OIDC':
return'OpenID Connect (OIDC)';
default:
returnthis.user?.provider||'Unknown';
}
}
}
publicisCommunityLanguage() {
publicisCommunityLanguage() {
@ -181,6 +255,38 @@ export class GfUserAccountSettingsComponent implements OnInit {
});
});
}
}
publiconLinkOidc() {
this.notificationService.confirm({
confirmFn:()=>{
consttoken=this.tokenStorageService.getToken();
if(token){
constform=document.createElement('form');
form.method='GET';
form.action='../api/auth/oidc';
constinput=document.createElement('input');
input.type='hidden';
input.name='linkToken';
input.value=token;
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}else{
this.snackBar.open(
$localize`Unable to initiate linking. Please log in again.`,
undefined,
{duration: ms('3 seconds')}
);
}
},
confirmType: ConfirmationDialogType.Warn,
discardLabel: $localize`Cancel`,
title: $localize`Link OIDC Provider`,
message: $localize`This will link your current account to an OIDC provider. After linking, you will be able to sign in using both your Security Token and OIDC. This action cannot be undone. Do you want to continue?`
});
}
publiconCloseAccount() {
publiconCloseAccount() {
this.notificationService.confirm({
this.notificationService.confirm({
confirmFn:()=>{
confirmFn:()=>{
@ -349,7 +455,7 @@ export class GfUserAccountSettingsComponent implements OnInit {