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