Remove pending access gate from hub runtime
This commit is contained in:
parent
17b2e684a6
commit
03f4044e35
|
|
@ -62,7 +62,7 @@ import {
|
||||||
} from "../shared/api/authApi";
|
} from "../shared/api/authApi";
|
||||||
import { updateOwnPassword, updateOwnProfile } from "../shared/api/profileApi";
|
import { updateOwnPassword, updateOwnProfile } from "../shared/api/profileApi";
|
||||||
import { acceptInvite, fetchPublicInvite, registerInvite, type PublicInviteResponse, type RegisterInviteCommand } from "../shared/api/inviteApi";
|
import { acceptInvite, fetchPublicInvite, registerInvite, type PublicInviteResponse, type RegisterInviteCommand } from "../shared/api/inviteApi";
|
||||||
import type { AccessRequest, CreateAccessRequestCommand } from "../entities/access-request/types";
|
import type { CreateAccessRequestCommand } from "../entities/access-request/types";
|
||||||
import { subscribeToNodeDCLogoutEvents } from "../shared/session/sessionSync";
|
import { subscribeToNodeDCLogoutEvents } from "../shared/session/sessionSync";
|
||||||
import { loadPersistedLauncherData } from "../shared/api/storageApi";
|
import { loadPersistedLauncherData } from "../shared/api/storageApi";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -132,12 +132,6 @@ export function LauncherApp() {
|
||||||
|
|
||||||
const me = useMemo(() => buildMe(data, resolvedProfileId, activeClientId), [data, resolvedProfileId, activeClientId]);
|
const me = useMemo(() => buildMe(data, resolvedProfileId, activeClientId), [data, resolvedProfileId, activeClientId]);
|
||||||
const activeProfileUser = data.users.find((user) => user.id === resolvedProfileId) ?? data.users[0];
|
const activeProfileUser = data.users.find((user) => user.id === resolvedProfileId) ?? data.users[0];
|
||||||
const currentAccessRequest = useMemo(() => {
|
|
||||||
if (!authSession?.authenticated || !authSession.user.email) return null;
|
|
||||||
|
|
||||||
const sessionEmail = authSession.user.email.toLowerCase();
|
|
||||||
return data.accessRequests.find((request) => request.email.toLowerCase() === sessionEmail && request.status !== "approved") ?? null;
|
|
||||||
}, [authSession, data.accessRequests]);
|
|
||||||
const runtimeMe = useMemo(() => {
|
const runtimeMe = useMemo(() => {
|
||||||
if (!authSession?.authenticated) return me;
|
if (!authSession?.authenticated) return me;
|
||||||
|
|
||||||
|
|
@ -864,10 +858,6 @@ export function LauncherApp() {
|
||||||
window.location.replace(authSession.logoutUrl);
|
window.location.replace(authSession.logoutUrl);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (currentAccessRequest) {
|
|
||||||
return <AccessRequestPendingScreen accessRequest={currentAccessRequest} onLogout={handleLogout} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="launcher-app">
|
<div className="launcher-app">
|
||||||
<TopBar
|
<TopBar
|
||||||
|
|
@ -1162,44 +1152,6 @@ function AccessRequestScreen({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AccessRequestPendingScreen({
|
|
||||||
accessRequest,
|
|
||||||
onLogout,
|
|
||||||
}: {
|
|
||||||
accessRequest: AccessRequest;
|
|
||||||
onLogout: () => void;
|
|
||||||
}) {
|
|
||||||
const isRejected = accessRequest.status === "rejected";
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="launcher-app nodedc-auth-page">
|
|
||||||
<NodeDcAuthBrandHeader />
|
|
||||||
<main className="nodedc-auth-page__main">
|
|
||||||
<section className="nodedc-auth-card nodedc-access-request-card" aria-live="polite">
|
|
||||||
<div className="nodedc-auth-card__copy">
|
|
||||||
<h1>NODE.DC.</h1>
|
|
||||||
<p>{isRejected ? "Заявка отклонена." : "Заявка ожидает подтверждения."}</p>
|
|
||||||
</div>
|
|
||||||
<div className="nodedc-invite-card__details">
|
|
||||||
<span>Почта: {accessRequest.email}</span>
|
|
||||||
<span>Компания: {accessRequest.company}</span>
|
|
||||||
</div>
|
|
||||||
<p className="nodedc-auth-card__status">
|
|
||||||
{isRejected
|
|
||||||
? "Администратор отклонил заявку. Если это ошибка, отправьте новый запрос или свяжитесь с NODE.DC."
|
|
||||||
: "Администратор проверит данные. После подтверждения вы попадёте в Launcher без отдельной регистрации по инвайту."}
|
|
||||||
</p>
|
|
||||||
<div className="nodedc-auth-card__form">
|
|
||||||
<button className="button button--primary" type="button" onClick={onLogout}>
|
|
||||||
Вернуться ко входу
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveAuthenticatedContext(
|
function resolveAuthenticatedContext(
|
||||||
data: LauncherData,
|
data: LauncherData,
|
||||||
session: AuthenticatedSession,
|
session: AuthenticatedSession,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue