forked from Business/AccountHub
Make change password feature work
This commit is contained in:
parent
991f36b57f
commit
400dffa96e
@ -34,6 +34,7 @@ if ($VARS['progress'] == "1") {
|
||||
$alert = lang("password expired", false);
|
||||
$alerttype = "info";
|
||||
$_SESSION['username'] = strtolower($VARS['username']);
|
||||
$_SESSION['uid'] = $database->get('accounts', 'uid', ['username' => strtolower($VARS['username'])]);
|
||||
$change_password = true;
|
||||
break;
|
||||
case "NORMAL":
|
||||
@ -109,6 +110,8 @@ if ($VARS['progress'] == "1") {
|
||||
$alerttype = MESSAGES["password_updated"]["type"];
|
||||
}
|
||||
switch (count($error)) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
$alert = lang(MESSAGES[$error[0]]["string"], false);
|
||||
$alerttype = MESSAGES[$error[0]]["type"];
|
||||
|
@ -87,19 +87,20 @@ function change_password($old, $new, $new2, &$error) {
|
||||
// Figure out how to change the password, then do it
|
||||
$acctloc = account_location($_SESSION['username']);
|
||||
if ($acctloc == "LOCAL") {
|
||||
$database->update('accounts', ['password' => encryptPassword($VARS['newpass'])], ['uid' => $_SESSION['uid']]);
|
||||
$_SESSION['password'] = $VARS['newpass'];
|
||||
$database->update('accounts', ['password' => encryptPassword($new), 'acctstatus' => 1], ['uid' => $_SESSION['uid']]);
|
||||
$_SESSION['password'] = $new;
|
||||
insertAuthLog(3, $_SESSION['uid']);
|
||||
return true;
|
||||
} else if ($acctloc == "LDAP") {
|
||||
try {
|
||||
$repository = $ldap->getRepository(LdapObjectType::USER);
|
||||
$user = $repository->findOneByUsername($_SESSION['username']);
|
||||
$user->setPassword($VARS['newpass']);
|
||||
$user->setPassword($new);
|
||||
$user->setpasswordMustChange(false);
|
||||
$ldap->persist($user);
|
||||
$database->update('accounts', ['acctstatus' => 1], ['uid' => $_SESSION['uid']]);
|
||||
insertAuthLog(3, $_SESSION['uid']);
|
||||
$_SESSION['password'] = $VARS['newpass'];
|
||||
$_SESSION['password'] = $new;
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
// Stupid password complexity BS error
|
||||
|
Loading…
x
Reference in New Issue
Block a user