Compare commits
No commits in common. "38cc436f4d7353c74ce5494d57e5f6315ab1d6b1" and "f205df36ffd5509be761aee67eae20ce945325bb" have entirely different histories.
38cc436f4d
...
f205df36ff
@ -44,6 +44,7 @@ class UserManager
|
|||||||
public static function login ($username, $password, $rememberMe) {
|
public static function login ($username, $password, $rememberMe) {
|
||||||
try {
|
try {
|
||||||
if ($user = Db::loadOne ('SELECT * FROM users WHERE (LOWER(username)=LOWER(?) OR LOWER(email)=LOWER(?))', array ($username, $username))) {
|
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 ($user['password'] == UserManager::getHashPassword($password)) {
|
||||||
if (isset($rememberMe) && $rememberMe == 'true') {
|
if (isset($rememberMe) && $rememberMe == 'true') {
|
||||||
setcookie ("rememberMe", self::setEncryptedCookie($user['username']), time () + (30 * 24 * 60 * 60 * 1000), BASEDIR, $_SERVER['HTTP_HOST'], 1);
|
setcookie ("rememberMe", self::setEncryptedCookie($user['username']), time () + (30 * 24 * 60 * 60 * 1000), BASEDIR, $_SERVER['HTTP_HOST'], 1);
|
||||||
@ -58,9 +59,7 @@ class UserManager
|
|||||||
throw new PDOException("Uživatel s tím to jménem neexistuje!");
|
throw new PDOException("Uživatel s tím to jménem neexistuje!");
|
||||||
}
|
}
|
||||||
} catch(PDOException $error) {
|
} catch(PDOException $error) {
|
||||||
$_SESSION['msg'] = $error->getMessage();
|
echo $error->getMessage();
|
||||||
unset($_POST);
|
|
||||||
header('Location: ' . BASEURL . 'login');
|
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,6 @@
|
|||||||
<div class="label">Remember me:</div>
|
<div class="label">Remember me:</div>
|
||||||
<input class="" type="checkbox" name="remember" value="true"/>
|
<input class="" type="checkbox" name="remember" value="true"/>
|
||||||
</div>
|
</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"/>
|
<input type="submit" class="button" name="login" value="Login"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -475,15 +475,6 @@ html {
|
|||||||
color: #a32929;
|
color: #a32929;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
|
||||||
border: 2px solid #a32929;
|
|
||||||
background-color: #f6cbcb;
|
|
||||||
color: #a32929;
|
|
||||||
padding: .75rem 1rem;
|
|
||||||
margin-bottom: .8em;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
|
Loading…
Reference in New Issue
Block a user