master
Joshua Sigona 3 years ago
parent 72a1913ab9
commit dbc0a878df
  1. 29
      src/App.js
  2. 2
      src/DEFAULTS.js
  3. 31
      src/TestHeader.js

@ -25,7 +25,6 @@ import md5 from 'md5';
const cookies = require('cookie-handler'); const cookies = require('cookie-handler');
const axios = require('axios'); const axios = require('axios');
const parse = require('csv-parse/lib/sync') const parse = require('csv-parse/lib/sync')
@ -864,8 +863,8 @@ function App() {
const [DATAID,setDATAID] = useState({GetData:()=>{}}) const [DATAID,setDATAID] = useState({GetData:()=>{}})
const [update,setUpdate] = useState(false) const [update,setUpdate] = useState(false)
const [LOGGEDINUSER,setLOGGEDINUSER] = useState("") const [LOGGEDINUSER,setLOGGEDINUSER] = useState(cookies.get("username"))
const [LOGGEDINHASH,setLOGGEDINHASH] = useState("") const [LOGGEDINHASH,setLOGGEDINHASH] = useState(cookies.get("password"))
const PANELPATHWBUILD = process.env.PUBLIC_URL+"/test/:BUILDID" const PANELPATHWBUILD = process.env.PUBLIC_URL+"/test/:BUILDID"
const PANELPATH = process.env.PUBLIC_URL+"/test" const PANELPATH = process.env.PUBLIC_URL+"/test"
@ -919,7 +918,11 @@ function App() {
<AdminPanel setUpdate={setUpdate} setTESTMODE={setTESTMODE} BACKENDURL={BACKENDURL} TESTMODE={TESTMODE} DATA={GetData}/> <AdminPanel setUpdate={setUpdate} setTESTMODE={setTESTMODE} BACKENDURL={BACKENDURL} TESTMODE={TESTMODE} DATA={GetData}/>
</Route> </Route>
<Route path={PANELPATHWBUILD}> <Route path={PANELPATHWBUILD}>
<TestHeader/> <TestHeader
LOGGEDINUSER={LOGGEDINUSER}
LOGGEDINHASH={LOGGEDINHASH}
BACKENDURL={GetBackendURL(BACKENDURL)}
/>
<TestPanel <TestPanel
APP_TITLE={APP_TITLE} APP_TITLE={APP_TITLE}
path={PANELPATHWBUILD} path={PANELPATHWBUILD}
@ -952,7 +955,11 @@ function App() {
/> />
</Route> </Route>
<Route path={PANELPATH}> <Route path={PANELPATH}>
<TestHeader/> <TestHeader
LOGGEDINUSER={LOGGEDINUSER}
LOGGEDINHASH={LOGGEDINHASH}
BACKENDURL={GetBackendURL(BACKENDURL)}
/>
<TestPanel <TestPanel
APP_TITLE={APP_TITLE} APP_TITLE={APP_TITLE}
path={PANELPATH} path={PANELPATH}
@ -988,14 +995,22 @@ function App() {
<Helmet> <Helmet>
<title>{APP_TITLE+" - Login"}</title> <title>{APP_TITLE+" - Login"}</title>
</Helmet> </Helmet>
<TestHeader/> <TestHeader
LOGGEDINUSER={LOGGEDINUSER}
LOGGEDINHASH={LOGGEDINHASH}
BACKENDURL={GetBackendURL(BACKENDURL)}
/>
<LoginForm BACKENDURL={BACKENDURL} TESTMODE={TESTMODE} LOGGEDINUSER={LOGGEDINUSER} LOGGEDINHASH={LOGGEDINHASH} setLOGGEDINHASH={setLOGGEDINHASH} setLOGGEDINUSER={setLOGGEDINUSER}/> <LoginForm BACKENDURL={BACKENDURL} TESTMODE={TESTMODE} LOGGEDINUSER={LOGGEDINUSER} LOGGEDINHASH={LOGGEDINHASH} setLOGGEDINHASH={setLOGGEDINHASH} setLOGGEDINUSER={setLOGGEDINUSER}/>
</Route> </Route>
<Route path={process.env.PUBLIC_URL+"/register"}> <Route path={process.env.PUBLIC_URL+"/register"}>
<Helmet> <Helmet>
<title>{APP_TITLE+" - Register"}</title> <title>{APP_TITLE+" - Register"}</title>
</Helmet> </Helmet>
<TestHeader/> <TestHeader
LOGGEDINUSER={LOGGEDINUSER}
LOGGEDINHASH={LOGGEDINHASH}
BACKENDURL={GetBackendURL(BACKENDURL)}
/>
<RegisterForm BACKENDURL={BACKENDURL} TESTMODE={TESTMODE} LOGGEDINUSER={LOGGEDINUSER} LOGGEDINHASH={LOGGEDINHASH} setLOGGEDINHASH={setLOGGEDINHASH} setLOGGEDINUSER={setLOGGEDINUSER}/> <RegisterForm BACKENDURL={BACKENDURL} TESTMODE={TESTMODE} LOGGEDINUSER={LOGGEDINUSER} LOGGEDINHASH={LOGGEDINHASH} setLOGGEDINHASH={setLOGGEDINHASH} setLOGGEDINUSER={setLOGGEDINUSER}/>
</Route> </Route>
<Route path={process.env.PUBLIC_URL+"/formula"}> <Route path={process.env.PUBLIC_URL+"/formula"}>

@ -2,7 +2,7 @@ const NICONICONII = process.env.PUBLIC_URL+"/icons/nicodotpng.png.png"
function DisplayIcon(icon) { function DisplayIcon(icon) {
//console.log(icon) //console.log(icon)
return icon&&icon.length>0?process.env.PUBLIC_URL+icon:NICONICONII return icon&&icon.length>0?icon.includes("http")?icon:process.env.PUBLIC_URL+icon:NICONICONII
} }
export {NICONICONII,DisplayIcon}; export {NICONICONII,DisplayIcon};

@ -1,6 +1,29 @@
import React from 'react'; import React, { useEffect,useState } from 'react';
import { DisplayIcon } from './DEFAULTS';
const axios = require('axios');
const cookies = require('cookie-handler');
function TestHeader(p) {
const [avatar,setAvatar] = useState(undefined);
const [username,setUsername] = useState(undefined);
useEffect(()=>{
axios.post(p.BACKENDURL+"/validUser",{
username:p.LOGGEDINUSER,
password:p.LOGGEDINHASH,
recoveryhash:cookies.get("userID")
})
.then((data)=>{
if (data.data.verified) {
setAvatar(data.data.avatar)
setUsername(p.LOGGEDINUSER)
}
})}
,[])
function TestHeader() {
return ( return (
<header> <header>
<div className="headerWrapper"> <div className="headerWrapper">
@ -13,8 +36,8 @@ function TestHeader() {
<section className="miniNav"><a href=".">&#9776;</a></section> <section className="miniNav"><a href=".">&#9776;</a></section>
</div> </div>
<div className="rightNav"> <div className="rightNav">
<section className="loginNav"><a href="."><img alt="." src={process.env.PUBLIC_URL + '/icons/nicodotpng.png.png'} /> Guest &emsp; <span className="dotMenu">&#xb7;&#xb7;&#xb7;</span></a></section> <section className="loginNav"><a href="."><img alt="." src={DisplayIcon(avatar)} /> {username??"Guest"} &emsp; <span className="dotMenu">&#xb7;&#xb7;&#xb7;</span></a></section>
<section className="miniNav"><a href="."><img alt="." src={process.env.PUBLIC_URL + '/icons/nicodotpng.png.png'} /></a></section> <section className="miniNav"><a href="."><img alt="." src={DisplayIcon(avatar)} /></a></section>
</div> </div>
</div> </div>
</header> </header>

Loading…
Cancel
Save