Misc changes
parent
7f97031409
commit
5543b1e8c5
1
chat.css
1
chat.css
|
@ -10,6 +10,7 @@ form {
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
|
margin-top: 1%;
|
||||||
padding: 2%;
|
padding: 2%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: darkgrey;
|
background-color: darkgrey;
|
||||||
|
|
6
chat.js
6
chat.js
|
@ -12,6 +12,7 @@ form.addEventListener("submit", async function (event) {
|
||||||
|
|
||||||
formMessage = formData.get('message').toString();
|
formMessage = formData.get('message').toString();
|
||||||
|
|
||||||
|
//KINDA UNNECESSARY
|
||||||
//CHECKS TO SEE IF THE PERSON IS LOGGED IN IN ORDER TO SEND A MESSAGE.
|
//CHECKS TO SEE IF THE PERSON IS LOGGED IN IN ORDER TO SEND A MESSAGE.
|
||||||
const response = await fetch(`api/token/${username}/`);
|
const response = await fetch(`api/token/${username}/`);
|
||||||
const matches = await response.json();
|
const matches = await response.json();
|
||||||
|
@ -75,11 +76,10 @@ function printText(text) {
|
||||||
//LOGGED IN STUFF
|
//LOGGED IN STUFF
|
||||||
//TODO ADD CHECK TO SEE IF USERNAME AND TOKEN MATCHES
|
//TODO ADD CHECK TO SEE IF USERNAME AND TOKEN MATCHES
|
||||||
function loggedIn() {
|
function loggedIn() {
|
||||||
username = localStorage.getItem('username');
|
if (username === '' || username === null) {
|
||||||
if (username === null) {
|
|
||||||
document.querySelector("#loggeduser").innerHTML = 'You are not logged in'
|
document.querySelector("#loggeduser").innerHTML = 'You are not logged in'
|
||||||
} else {
|
} else {
|
||||||
document.querySelector("#loggeduser").innerHTML = `You are logged in as ${username}`
|
document.querySelector("#loggeduser").innerHTML = `You are logged in as "${username}"`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
login.js
2
login.js
|
@ -48,10 +48,10 @@ async function loginFetch() {
|
||||||
// FUNCTIONS FOR WHETHER THE LOGIN WAS A SUCCESS OR FAILURE
|
// FUNCTIONS FOR WHETHER THE LOGIN WAS A SUCCESS OR FAILURE
|
||||||
|
|
||||||
function login() {
|
function login() {
|
||||||
window.location.replace("/index.html")
|
|
||||||
document.querySelector("#errormessage").innerHTML = ''
|
document.querySelector("#errormessage").innerHTML = ''
|
||||||
localStorage.setItem('username', `${uname}`);
|
localStorage.setItem('username', `${uname}`);
|
||||||
document.querySelector("#username").innerHTML = `Logged in as ${uname}`
|
document.querySelector("#username").innerHTML = `Logged in as ${uname}`
|
||||||
|
window.location.replace("/index.html")
|
||||||
}
|
}
|
||||||
|
|
||||||
function incorrectLogin() {
|
function incorrectLogin() {
|
||||||
|
|
Loading…
Reference in New Issue