Erzwingung der Passwortänderung bei erstem Login ermöglicht (forcepwreset)
This commit is contained in:
1 parent
1487e8b38c
commit
1566aeaf2f
4 files changed
+87
-11
No files matched your search
+9
-2
@@ -25,17 +25,24 @@ try {
|
||||
$user = explode('@', $_POST['username']);
|
||||
$pw = $_POST['password'];
|
||||
|
||||
$abfrage = "SELECT `id`, `password`, `admin` FROM `accounts` WHERE `username` = :username AND `domain` = :domain AND `enabled`='1'";
|
||||
$abfrage = "SELECT `id`, `password`, `forcepwreset`, `admin` FROM `accounts` WHERE `username` = :username AND `domain` = :domain AND `enabled`='1' OR (`enabled`='0' AND `forcepwreset`='1')";
|
||||
$sth = $dbh->prepare($abfrage);
|
||||
$sth->execute(array(':username' => $user[0], ':domain' => $user[1]));
|
||||
$userdata = $sth->fetchAll();
|
||||
if ($sth->rowCount() > 0) {
|
||||
if (password_verify($pw, $userdata[0]['password'])) {
|
||||
$_SESSION['log'] = 1;
|
||||
$_SESSION['username'] = $user[0];
|
||||
$_SESSION['domain'] = $user[1];
|
||||
$_SESSION['admin'] = $userdata[0]['admin'];
|
||||
$_SESSION['mailID'] = $userdata[0]['id'];
|
||||
if ($userdata[0]['forcepwreset']) {
|
||||
$_SESSION['forcepwreset'] = 1;
|
||||
$_SESSION['log'] = 0;
|
||||
header("Location: bin/forcedpwreset.php");
|
||||
exit;
|
||||
}
|
||||
$_SESSION['forcepwreset'] = 0;
|
||||
$_SESSION['log'] = 1;
|
||||
header("Location: settings.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user