Misc changes
This commit is contained in:
		
							parent
							
								
									7f97031409
								
							
						
					
					
						commit
						5543b1e8c5
					
				
					 3 changed files with 5 additions and 4 deletions
				
			
		
							
								
								
									
										1
									
								
								chat.css
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								chat.css
									
									
									
									
									
								
							|  | @ -10,6 +10,7 @@ form { | |||
| } | ||||
| 
 | ||||
| input { | ||||
|     margin-top: 1%; | ||||
|     padding: 2%; | ||||
|     width: 100%; | ||||
|     background-color: darkgrey; | ||||
|  |  | |||
							
								
								
									
										6
									
								
								chat.js
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								chat.js
									
									
									
									
									
								
							|  | @ -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}"` | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										2
									
								
								login.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								login.js
									
									
									
									
									
								
							|  | @ -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() { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue