-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(auth): Fix auth state
- Loading branch information
Showing
11 changed files
with
102 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Tavern - Red Team Engagement Platform</title><script defer="defer" src="/static/js/main.e23b68d3.js"></script><link href="/static/css/main.ab681a40.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Tavern - Red Team Engagement Platform</title><script defer="defer" src="/static/js/main.9767f405.js"></script><link href="/static/css/main.ab681a40.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> |
6 changes: 3 additions & 3 deletions
6
...rnal/www/build/static/js/main.e23b68d3.js → ...rnal/www/build/static/js/main.9767f405.js
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tavern/internal/www/src/components/access-gate/AccessGate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useContext } from "react"; | ||
import { AuthorizationContext } from "../../context/AuthorizationContext"; | ||
import { EmptyState, EmptyStateType } from "../tavern-base-ui/EmptyState"; | ||
|
||
type Props = { | ||
children: any; | ||
} | ||
export const AccessGate = (props: Props) => { | ||
const {children} = props; | ||
const {data, isLoading, error} = useContext(AuthorizationContext); | ||
|
||
if(isLoading){ | ||
return ( | ||
<div className="flex flex-row w-sceen h-screen justify-center items-center"> | ||
<EmptyState label="Loading authroization state" type={EmptyStateType.loading}/> | ||
</div> | ||
); | ||
} | ||
|
||
if(error){ | ||
return ( | ||
<div className="flex flex-row w-sceen h-screen justify-center items-center"> | ||
<EmptyState label="Error fetching authroization state" type={EmptyStateType.error} details="Please contact your admin to diagnose the issue."/> | ||
</div> | ||
); | ||
} | ||
|
||
if(data?.me?.isActivated){ | ||
return children; | ||
} | ||
|
||
return ( | ||
<div className="flex flex-row w-sceen h-screen justify-center items-center"> | ||
<EmptyState label="Account not approved" details={`Gain approval by providing your id (${data?.me?.id}) to an admin.`} type={EmptyStateType.noData}/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {AccessGate} from "./AccessGate"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters