mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 15:41:27 +00:00
misc: resolve shared secret within org and added login redirect
This commit is contained in:
@@ -2,6 +2,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import { SessionStorageKeys } from "@app/const";
|
||||
|
||||
import { organizationKeys } from "../organization/queries";
|
||||
import { setAuthToken } from "../reactQuery";
|
||||
@@ -86,6 +87,21 @@ export const useSelectOrganization = () => {
|
||||
SecurityClient.setProviderAuthToken("");
|
||||
}
|
||||
|
||||
if (data.token && !data.isMfaEnabled) {
|
||||
// We check if there is a pending callback after organization login success and redirect to it if valid
|
||||
const loginRedirectInfo = sessionStorage.getItem(
|
||||
SessionStorageKeys.ORG_LOGIN_SUCCESS_REDIRECT_URL
|
||||
);
|
||||
sessionStorage.removeItem(SessionStorageKeys.ORG_LOGIN_SUCCESS_REDIRECT_URL);
|
||||
|
||||
if (loginRedirectInfo) {
|
||||
const { expiry, data: redirectUrl } = JSON.parse(loginRedirectInfo);
|
||||
if (new Date() < new Date(expiry)) {
|
||||
window.location.assign(redirectUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
|
||||
Reference in New Issue
Block a user