diff --git a/src/App.js b/src/App.js index 2287c5c..ae706f7 100644 --- a/src/App.js +++ b/src/App.js @@ -608,7 +608,7 @@ function LoginForm(p) { function SubmitLogin() { setError("") setLoading(true) - axios.post(GetBackendURL(p)+"/login",{ + axios.post(GetBackendURL(p)+"/validUser",{ username:username, password:md5(password) }) @@ -619,6 +619,7 @@ function LoginForm(p) { setUsername("") setPassword("") setRememberMe(false) + history.push("/") } else { setError("Could not authenticate!") } @@ -635,11 +636,11 @@ function LoginForm(p) { {loading? - :<>

{error}

+ :<>
{if (f.key==="Enter") {SubmitLogin()}}}>

{error}

{setUsername(p.currentTarget.value)}} placeholder="Username"/>
{setPassword(p.currentTarget.value)}} placeholder="Password"/>
{setRememberMe(p.currentTarget.checked)}}/>
- +
}
} @@ -648,6 +649,7 @@ function RegisterForm(p) { const [username,setUsername] = useState("") const [password,setPassword] = useState("") const [password2,setPassword2] = useState("") + const [email,setEmail] = useState("") const [rememberMe,setRememberMe] = useState(false) const [error,setError] = useState("") const [loading,setLoading] = useState(false) @@ -666,6 +668,7 @@ function RegisterForm(p) { if (username.length>20) {throw "Username must be less than 21 characters in length."} if (password.length<6) {throw "Password must contain at least 6 characters."} if (password!==password2) {throw "Password fields must match."} + if (!email.includes("@")) {throw "Invalid E-mail."} }catch(err){ setError(err) setLoading(false) @@ -673,7 +676,8 @@ function RegisterForm(p) { } axios.post(GetBackendURL(p)+"/register",{ username:username, - password:md5(password) + password:md5(password), + email:email }) .then((data)=>{ if (data.data.verified) { @@ -699,9 +703,10 @@ function RegisterForm(p) { {loading? :<>

{error}

- {setUsername(p.currentTarget.value)}} placeholder="Username" tooltip="Enter a username (4-20 characters, alphanumeric only)"/>
+ {setUsername(p.currentTarget.value)}} placeholder="Username" tooltip="Enter a username (4-20 characters, a-z and _ only)"/>
{setPassword(p.currentTarget.value)}} placeholder="Password" tooltip="Enter a password (6 or more characters)"/>
{setPassword2(p.currentTarget.value)}} placeholder="Verify Password" tooltip="Enter password again."/>
+ {setEmail(p.currentTarget.value)}} placeholder="email@example.com" tooltip="This is used to send you password reset emails."/>
{setRememberMe(p.currentTarget.checked)}}/>
} @@ -747,8 +752,8 @@ function App() { const [DATA,setDATA] = useState({GetData:()=>{}}) const [DATAID,setDATAID] = useState({GetData:()=>{}}) - const [LOGGEDINUSER,setLOGGEDINUSER] = useState("sigonasr2") - const [LOGGEDINHASH,setLOGGEDINHASH] = useState("7355ddfc5b81291cdd2c3025976c108c") + const [LOGGEDINUSER,setLOGGEDINUSER] = useState("") + const [LOGGEDINHASH,setLOGGEDINHASH] = useState("") function GetData(table,row,col,id){ diff --git a/src/TestPanel.js b/src/TestPanel.js index eef01f7..8c2c2c7 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -3,6 +3,9 @@ import Modal from 'react-modal' import { DisplayIcon } from './DEFAULTS'; import { ExpandTooltip } from './components/ExpandTooltip'; +//Helper variables for Weapon selector with structure: [weapon_type,weapon,potential,potential_tooltip,weapon_existence_data] +const WEAPON_WEAPONTYPE=0;const WEAPON_WEAPON=1;const WEAPON_POTENTIAL=2;const WEAPON_POTENTIAL_TOOLTIP=3;const WEAPON_EXISTENCE_DATA=4; + /** * Hook that alerts clicks outside of the passed ref */ @@ -162,6 +165,10 @@ function SelectorWindow(p) { } +function GetSpecialWeaponName(item) { + return item[WEAPON_EXISTENCE_DATA]!==undefined?(item[WEAPON_EXISTENCE_DATA].special_name?.length>0)?item[WEAPON_EXISTENCE_DATA].special_name:(item[WEAPON_WEAPON].name+" "+item[WEAPON_WEAPONTYPE].name):"" +} + function TestPanel(p) { const [bpGraphMax,setbpGraphMax] = useState(1000) const [hpGraphMax,sethpGraphMax] = useState(1000) @@ -185,9 +192,6 @@ const [classSkillTreeWindowOpen,setClassSkillTreeWindowOpen] = useState(false) const [weaponSelectWindowOpen,setWeaponSelectWindowOpen] = useState(false) const [armorSelectWindowOpen,setArmorSelectWindowOpen] = useState(false) -//Helper variables for Weapon selector with structure: [weapon_type,weapon,potential,potential_tooltip,weapon_existence_data] -const WEAPON_WEAPONTYPE=0;const WEAPON_WEAPON=1;const WEAPON_POTENTIAL=2;const WEAPON_POTENTIAL_TOOLTIP=3;const WEAPON_EXISTENCE_DATA=4; - const [selectedWeapon,setSelectedWeapon] = useState([]) const [selectedArmor1,setSelectedArmor1] = useState([]) const [selectedArmor2,setSelectedArmor2] = useState([]) @@ -297,7 +301,7 @@ useEffect(()=>{

Equipped Weapon

-

{selectedWeapon[WEAPON_WEAPON]?.name + " " + selectedWeapon[WEAPON_WEAPONTYPE]?.name}+40

+

{GetSpecialWeaponName(selectedWeapon)}+40

{weaponPage === 1 ? @@ -586,7 +590,7 @@ AUGMENT } }} displayFunction={(item)=>{ - return
  • {setSelectedWeapon(item);setWeaponSelectWindowOpen(false)}}>
    {item[WEAPON_EXISTENCE_DATA].special_name ?? item[WEAPON_WEAPON].name+" "+item[WEAPON_WEAPONTYPE].name}

    {item[WEAPON_WEAPON].atk} {item[WEAPON_POTENTIAL_TOOLTIP].map((pot,i)=><>{(i!==0)&&
    }{pot.name}: {pot.description?pot.description.split("\\n").map((it)=><>{it}
    ):<>})}}> + return
  • {setSelectedWeapon(item);setWeaponSelectWindowOpen(false)}}>
    {GetSpecialWeaponName(item)}

    {item[WEAPON_WEAPON].atk} {item[WEAPON_POTENTIAL_TOOLTIP].map((pot,i)=><>{(i!==0)&&
    }{pot.name}: {pot.description?pot.description.split("\\n").map((it)=><>{it}
    ):<>})}}> {item[WEAPON_POTENTIAL].name}
  • }} />