Fix some for iam

This commit is contained in:
Montech
2026-10-11 15:24:16 +03:30
parent 2e21758c2c
commit e4924a28f5
211 changed files with 404 additions and 358 deletions
+16 -2
View File
@@ -94,12 +94,26 @@ export const router = createRouter({
// user away from /login, and blocks unauthenticated access to routes that
// require a session (legacy blocked ordersList/transactionsList/profileData/
// favoritesList/completeProfile the same way).
// هر بارگذاری کامل صفحه یک بار بررسی می‌شود. پرچم sessionStorage فقط
// همان برگشتِ بی‌صدا از IAM را متوقف می‌کند تا صفحهٔ ورود در حلقه نیفتد.
let silentSsoAttempted = false;
function skipSilentSso(): boolean {
if (sessionStorage.getItem('gb_iam_sso_skip') === '1') {
sessionStorage.removeItem('gb_iam_sso_skip');
silentSsoAttempted = true;
return true;
}
return silentSsoAttempted;
}
router.beforeEach(async (to) => {
const session = useSessionStore();
const nav = useNavStore();
if (!session.isLoggedIn && to.name !== 'iamCallback' && sessionStorage.getItem('gb_iam_sso_checked') !== '1') {
sessionStorage.setItem('gb_iam_sso_checked', '1');
if (!session.isLoggedIn && to.name !== 'iamCallback' && !skipSilentSso()) {
silentSsoAttempted = true;
sessionStorage.removeItem('gb_iam_sso_checked');
try {
const started = await api.ssoStart();
if (started.enabled && started.authorize_url) {