Merge branch 'remastering' of https://gitea.steelants.cz/SH/PHP_SMART_HOME_V3 into remastering
This commit is contained in:
		| @@ -44,7 +44,6 @@ class UserManager | ||||
| 	public static function login ($username, $password, $rememberMe) { | ||||
| 		try { | ||||
| 			if ($user = Db::loadOne ('SELECT * FROM users WHERE (LOWER(username)=LOWER(?) OR LOWER(email)=LOWER(?))', array ($username, $username))) { | ||||
| 				var_dump($user); | ||||
| 				if ($user['password'] == UserManager::getHashPassword($password)) { | ||||
| 					if (isset($rememberMe) && $rememberMe == 'true') { | ||||
| 						setcookie ("rememberMe", self::setEncryptedCookie($user['username']), time () + (30 * 24 * 60 * 60 * 1000), BASEDIR, $_SERVER['HTTP_HOST'], 1); | ||||
| @@ -59,7 +58,9 @@ class UserManager | ||||
| 				throw new PDOException("Uživatel s tím to jménem neexistuje!"); | ||||
| 			} | ||||
| 		} catch(PDOException $error) { | ||||
| 			echo $error->getMessage(); | ||||
| 			$_SESSION['msg'] = $error->getMessage(); | ||||
| 			unset($_POST); | ||||
| 			header('Location: ' . BASEURL . 'login'); | ||||
| 			die(); | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
| @@ -14,6 +14,10 @@ | ||||
|                 <div class="label">Remember me:</div> | ||||
|                 <input class="" type="checkbox" name="remember" value="true"/> | ||||
|             </div> | ||||
| 				<?php if (!empty ($_SESSION['msg'])): ?> | ||||
| 					<label class="message"><?php echo $_SESSION['msg']; ?></label><br/><br/> | ||||
| 					<?php unset ($_SESSION['msg']); ?> | ||||
| 				<?php endif; ?> | ||||
|             <input type="submit" class="button" name="login" value="Login"/> | ||||
|         </form> | ||||
|     </div> | ||||
|   | ||||
| @@ -475,6 +475,15 @@ html { | ||||
| 	color: #a32929; | ||||
|   } | ||||
|  | ||||
|   .message { | ||||
| 	border: 2px solid #a32929; | ||||
| 	background-color: #f6cbcb; | ||||
| 	color: #a32929; | ||||
| 	padding: .75rem 1rem; | ||||
| 	margin-bottom: .8em; | ||||
| 	width: 100%; | ||||
|   } | ||||
|  | ||||
|   .content { | ||||
| 	 width: fit-content; | ||||
| 	 margin: 5px; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user