diff --git a/src/App.tsx b/src/App.tsx
index d21e84d..dbc57bf 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -48,7 +48,7 @@ function App()
{
to: '/home', label: 'Home', items: [
{ to: '/profile', label: 'Profile', relative: true },
- { to: '/applications', label: 'Applications', relative: true }
+ { to: '/applications', label: 'Applications', relative: true, permission: [ 'applications', 5 ] }
]
},
{
diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx
index 27d8174..b81dd76 100644
--- a/src/pages/Home.tsx
+++ b/src/pages/Home.tsx
@@ -4,8 +4,9 @@ import '../css/pages/Home.css';
import ErrorBoundary from '../util/ErrorBoundary';
import Applications from './home/Applications';
import Profile from './home/Profile';
+import { PermissionBarrier } from '../structures/PermissionBarrier';
-const Main = () =>
+const Main = () =>
{
return
@@ -13,14 +14,18 @@ const Main = () =>
;
};
-const Home = () =>
+const Home = () =>
{
return
} />
} />
- } />
+
+
+
+ } />
;
};
diff --git a/src/pages/home/Profile.tsx b/src/pages/home/Profile.tsx
index 0c98ae4..43eb30e 100644
--- a/src/pages/home/Profile.tsx
+++ b/src/pages/home/Profile.tsx
@@ -1,44 +1,45 @@
import React, { useRef, useState } from 'react';
-import { capitalise, get, post } from '../../util/Util';
+import { capitalise, clearSession, get, post } from '../../util/Util';
import { useLoginContext } from '../../structures/UserContext';
import { FileSelector } from '../../components/InputElements';
import { ExternalProfile as EP, User } from '../../@types/ApiStructures';
+import { useNavigate } from 'react-router';
-const TwoFactorControls = ({ user }: {user: User}) =>
+const TwoFactorControls = ({ user }: {user: User}) =>
{
const [ twoFactorError, set2FAError ] = useState(null);
const [ displayInput, setDisplayInput ] = useState(false);
const [ qr, setQr ] = useState(null);
- const displayQr = async () =>
+ const displayQr = async () =>
{
const response = await get('/api/user/2fa');
- if (response.status !== 200)
+ if (response.status !== 200)
return set2FAError(response.message || 'Uknown error');
setQr(response.message as string);
};
const codeRef = useRef(null);
- const disable2FA: React.MouseEventHandler = async (event) =>
+ const disable2FA: React.MouseEventHandler = async (event) =>
{
event.preventDefault();
const code = codeRef.current?.value;
- if (!code)
+ if (!code)
return;
const response = await post('/api/user/2fa/disable', { code });
- if (response.status !== 200)
+ if (response.status !== 200)
return set2FAError(response.message || 'Unknown error');
};
- const submitCode: React.MouseEventHandler = async (event) =>
+ const submitCode: React.MouseEventHandler = async (event) =>
{
event.preventDefault();
const code = codeRef.current?.value;
- if (!code)
+ if (!code)
return;
const response = await post('/api/user/2fa/verify', { code });
- if (response.status !== 200)
+ if (response.status !== 200)
return set2FAError(response.message || 'Unknown error');
};
@@ -55,7 +56,7 @@ const TwoFactorControls = ({ user }: {user: User}) =>
;
- if (user.twoFactor)
+ if (user.twoFactor)
inner =