// Set New Admin Password
private function _setNewAdminPassword() {
global $locale;
// Only accept if user is admin, updating his profile (not admin panel)
if (iADMIN && $this->_method == "validate_update" && !$this->isAdminPanel) {
if ($this->_getPasswordInput("user_admin_password") == "") {
if ($this->userData['user_admin_password'] == "") {
$this->_isValidCurrentAdminPassword = true;
$showError = false;
} else {
$this->_isValidCurrentAdminPassword = false;
$showError = true;
}
} else {
$this->_isValidCurrentAdminPassword = $this->_isValidCurrentPassword(false, false);
$showError = true;
}
//$this->_isValidCurrentAdminPassword = $this->_isValidCurrentPassword(false, false);
$this->_newUserAdminPassword = $this->_getPasswordInput("user_new_admin_password");
$this->_newUserAdminPassword2 = $this->_getPasswordInput("user_new_admin_password2");
// Require current password
if ($this->_isValidCurrentAdminPassword) {
// Require current admin password
if ($this->_isValidCurrentPassword) {
if ($this->_userAdminPassword != $this->_userPassword) {
// Intialize password auth
$passAuth = new PasswordAuth();
$passAuth->inputPassword = $this->_userAdminPassword;
$passAuth->inputNewPassword = $this->_newUserAdminPassword;
$passAuth->inputNewPassword2 = $this->_newUserAdminPassword2;
// Check admin new password
$_isValidNewPassword = $passAuth->isValidNewPassword();
if ($_isValidNewPassword === 0) {
// New password is valid
$this->_setDBValue("user_admin_algo", $passAuth->getNewAlgo());
$this->_setDBValue("user_admin_salt", $passAuth->getNewSalt());
$this->_setDBValue("user_admin_password", $passAuth->getNewHash());
} else {
if ($_isValidNewPassword === 1) {
// New Password equal old password
$this->_setError("user_password", $locale['u144'].$locale['u146'].$locale['u131']);
} elseif ($_isValidNewPassword === 2) {
// The two new passwords are not identical
$this->_setError("user_password", $locale['u148a']);
} elseif ($_isValidNewPassword === 3) {
// New password contains invalid chars / symbols
$this->_setError("user_password", $locale['u144'].$locale['u142']."<br />".$locale['u147']);
}
}
} else {
// New admin password equal Login password
$this->_setError("user_admin_password", $locale['u144'].$locale['u146'].$locale['u133']);
}
} else {
// Current login password is invalid
$this->_setError("user_admin_password", $locale['u149b']);
}
} else {
// Current admin password is invalid
$this->_setError("user_admin_password", $locale['u149a'], $showError);
}
}
}
Category Forum
Suspected Bugs and Errors - 8Labels
None yet
Statistics
2 participants
Notifications
You are not receiving notifications from this thread.
Related Questions