Permalink
Browse files

Change password only if changed

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1321 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 7896227 commit e3492e8e6fe5600f52c8af0f7ca35a9cc7c1e498 jakubvrana committed Feb 19, 2010
Showing with 4 additions and 6 deletions.
  1. +4 −6 adminer/user.inc.php
View
@@ -50,10 +50,10 @@
if ($_POST["drop"]) {
query_redirect("DROP USER $old_user", ME . "privileges=", lang('User has been dropped.'));
} else {
- if ($old_user == $new_user) {
- queries("SET PASSWORD FOR $new_user = " . ($_POST["hashed"] ? $pass : "PASSWORD($pass)"));
- } else {
+ if ($old_user != $new_user) {
$error = !queries(($connection->server_info < 5 ? "GRANT USAGE ON *.* TO" : "CREATE USER") . " $new_user IDENTIFIED BY" . ($_POST["hashed"] ? " PASSWORD" : "") . " $pass");
+ } elseif ($_POST["pass"] != $old_pass || !$_POST["hashed"]) {
+ queries("SET PASSWORD FOR $new_user = " . ($_POST["hashed"] ? $pass : "PASSWORD($pass)"));
}
if (!$error) {
$revoke = array();
@@ -107,9 +107,7 @@
} else {
$row = $_GET + array("host" => $connection->result($connection->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"))); // create user on the same domain by default
$row["pass"] = $old_pass;
- if ($old_pass != "") {
- $row["hashed"] = true;
- }
+ $row["hashed"] = true;
$grants[""] = true;
}

0 comments on commit e3492e8

Please sign in to comment.