Misc changes

main
Luna 2021-07-24 12:58:53 -07:00
parent 7f97031409
commit 5543b1e8c5
3 changed files with 5 additions and 4 deletions

View File

@ -10,6 +10,7 @@ form {
}
input {
margin-top: 1%;
padding: 2%;
width: 100%;
background-color: darkgrey;

View File

@ -12,6 +12,7 @@ form.addEventListener("submit", async function (event) {
formMessage = formData.get('message').toString();
//KINDA UNNECESSARY
//CHECKS TO SEE IF THE PERSON IS LOGGED IN IN ORDER TO SEND A MESSAGE.
const response = await fetch(`api/token/${username}/`);
const matches = await response.json();
@ -75,11 +76,10 @@ function printText(text) {
//LOGGED IN STUFF
//TODO ADD CHECK TO SEE IF USERNAME AND TOKEN MATCHES
function loggedIn() {
username = localStorage.getItem('username');
if (username === null) {
if (username === '' || username === null) {
document.querySelector("#loggeduser").innerHTML = 'You are not logged in'
} else {
document.querySelector("#loggeduser").innerHTML = `You are logged in as ${username}`
document.querySelector("#loggeduser").innerHTML = `You are logged in as "${username}"`
}
}

View File

@ -48,10 +48,10 @@ async function loginFetch() {
// FUNCTIONS FOR WHETHER THE LOGIN WAS A SUCCESS OR FAILURE
function login() {
window.location.replace("/index.html")
document.querySelector("#errormessage").innerHTML = ''
localStorage.setItem('username', `${uname}`);
document.querySelector("#username").innerHTML = `Logged in as ${uname}`
window.location.replace("/index.html")
}
function incorrectLogin() {