Commit
This commit is contained in:
		
							parent
							
								
									6080f1b6f5
								
							
						
					
					
						commit
						bde5082805
					
				| @ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| // TODO: this stinks...
 | ||||
| // TODO: this shit stinks...
 | ||||
| class User  | ||||
| { | ||||
|     private Session $session; | ||||
| @ -23,7 +23,8 @@ class User | ||||
|             $this->username = $this->session->get('username'); | ||||
|             $this->password = $this->session->get('password'); | ||||
| 
 | ||||
|             if (!$this->authenticate($this->username, $this->password)) { | ||||
|             if (!$this->authenticate($this->username, $this->password)) | ||||
|             { | ||||
|                 $this->logout(); | ||||
|                 $this->session->flash('Kontodetaljer endret, vennligst logg inn igjen', 'warning'); | ||||
|             } | ||||
| @ -49,7 +50,7 @@ class User | ||||
|     // Check if user and pass match
 | ||||
|     private function authenticate(string $username, string $password): bool | ||||
|     { | ||||
|         if ($username === 'Willaiam' && $password === 'William') | ||||
|         if ($username === 'William' && $password === 'William') | ||||
|         { | ||||
|             return TRUE; | ||||
|         } | ||||
| @ -59,8 +60,8 @@ class User | ||||
|     public function logout(): void | ||||
|     { | ||||
|         $this->session->set('loggedIn', FALSE); | ||||
|         $this->session->remove('username', FALSE); | ||||
|         $this->session->remove('password', FALSE); | ||||
|         $this->session->remove('username'); | ||||
|         $this->session->remove('password'); | ||||
|         $this->setProperties(); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user