Added link to admin panel

Resolved #11
This commit is contained in:
2021-03-12 13:32:19 +11:00
parent d66d0bc9da
commit 8a920c5316
4 changed files with 21 additions and 10 deletions
+6 -6
View File
@@ -47,19 +47,19 @@ To set up this template in development mode:
- Logging in and out - Logging in and out
- Account deletion - Account deletion
- Password management - Password management
- Fully Featured Administration Panel - JSON web token authentication
- A default admin account (if desired)
- News Blog - News Blog
- Optional microservice - Optional microservice
- Secure publishing and editing of articles - Secure publishing and editing of articles via admin panel
- Easy To Use Configuraton Script: - Easy To Use Configuraton Script
- ~~Default UUID keys~~ - Sets up everything via docker
- ~~Docker, docker, docker.~~ - A default admin account (if desired)
# Coming Soon # Coming Soon
- Full documentation - Full documentation
- Setup tutorial - Setup tutorial
- Modding tutorial
- Fully Featured Chat System - Fully Featured Chat System
- Optional microservice - Optional microservice
- Chat logs - Chat logs
+3 -1
View File
@@ -39,12 +39,14 @@ const Account = props => {
<h1 className='centered'>Account</h1> <h1 className='centered'>Account</h1>
<form className='constricted' onSubmit={async evt => { <form className='constricted' onSubmit={async evt => {
evt.preventDefault(); evt.preventDefault();
const [err, result] = await update(passwordRef.current.value, retypeRef.current.value, contactRef.current.checked, authTokens.tokenFetch); const [err] = await update(passwordRef.current.value, retypeRef.current.value, contactRef.current.checked, authTokens.tokenFetch);
if (err) { if (err) {
alert(err); alert(err);
return; return;
} }
alert('Details updated');
passwordRef.current.value = retypeRef.current.value = ''; passwordRef.current.value = retypeRef.current.value = '';
}}> }}>
<div> <div>
+1 -1
View File
@@ -11,7 +11,7 @@ const Admin = props => {
const authTokens = useContext(TokenContext); const authTokens = useContext(TokenContext);
//misplaced? (admin only) //misplaced? (admin only)
if (!authTokens.accessToken || !authTokens.getPayload().privilege == 'administrator') { if (!authTokens.accessToken || authTokens.getPayload().privilege != 'administrator') {
return <Redirect to='/' />; return <Redirect to='/' />;
} }
+11 -2
View File
@@ -7,7 +7,7 @@ const Visitor = () => {
return ( return (
<div> <div>
<Link to='/signup'>Sign Up</Link> <Link to='/signup'>Sign Up</Link>
<em> - </em> <span> - </span>
<Link to='/login'>Log In</Link> <Link to='/login'>Log In</Link>
</div> </div>
); );
@@ -19,7 +19,16 @@ const Member = () => {
return ( return (
<div> <div>
<Link to='/account'>Account</Link> <Link to='/account'>Account</Link>
<em> - </em> <span> - </span>
{ authTokens.getPayload().privilege == 'administrator' ?
<span>
<Link to='/admin'>Admin</Link>
<span> - </span>
</span>:
<span />
}
{ /* Logout button logs you out of the server too */ } { /* Logout button logs you out of the server too */ }
<Link to='/' onClick={async () => { <Link to='/' onClick={async () => {
const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/logout`, { //NOTE: this gets overwritten as a bugfix const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/logout`, { //NOTE: this gets overwritten as a bugfix