Skip to content

Commit 703d6a4

Browse files
xkostka2xkureck
authored andcommitted
fix(profile): fixed infinite loading in Authentication page
* fixed infinite loading in Authentication page when MFA is not available for the user
1 parent 4a59fae commit 703d6a4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

apps/user-profile/src/app/pages/settings-page/settings-authorization/settings-authentication.component.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ export class SettingsAuthenticationComponent implements OnInit, AfterViewInit {
7373
this.mfaAvailable = responseText === 'true';
7474
if (this.mfaAvailable) {
7575
this.loadMfa();
76+
} else {
77+
this.loadingMfa = false;
7678
}
7779
})
7880
.catch((e) => {
@@ -102,12 +104,18 @@ export class SettingsAuthenticationComponent implements OnInit, AfterViewInit {
102104
const enforceMfaAttributeName = this.store.get('mfa', 'enforce_mfa_attribute');
103105
this.attributesManagerService
104106
.getUserAttributeByName(this.store.getPerunPrincipal().userId, enforceMfaAttributeName)
105-
.subscribe((attr) => {
106-
if (attr.value) {
107-
this.toggle.toggle();
107+
.subscribe(
108+
(attr) => {
109+
if (attr.value) {
110+
this.toggle.toggle();
111+
}
112+
this.loadingMfa = false;
113+
},
114+
(e) => {
115+
console.error(e);
116+
this.loadingMfa = false;
108117
}
109-
this.loadingMfa = false;
110-
});
118+
);
111119
}
112120
if (sessionStorage.getItem('mfa_route')) {
113121
sessionStorage.removeItem('enforce_mfa');

0 commit comments

Comments
 (0)