diff --git a/.gitattributes b/.gitattributes index 562cf7e0..5cac1695 100644 --- a/.gitattributes +++ b/.gitattributes @@ -251,8 +251,10 @@ bureau/admin/sql_restore.php -text bureau/admin/sql_users_add.php -text bureau/admin/sql_users_del.php -text bureau/admin/sql_users_doadd.php -text +bureau/admin/sql_users_dopassword.php -text bureau/admin/sql_users_dorights.php -text bureau/admin/sql_users_list.php -text +bureau/admin/sql_users_password.php -text bureau/admin/sql_users_rights.php -text bureau/admin/sta2_add_raw.php -text bureau/admin/sta2_del_raw.php -text diff --git a/bureau/admin/hta_edit.php b/bureau/admin/hta_edit.php index 9513779c..79af6679 100644 --- a/bureau/admin/hta_edit.php +++ b/bureau/admin/hta_edit.php @@ -68,7 +68,7 @@ for($i=0;$i - +
<?php __(" />
diff --git a/bureau/admin/sql_users_dopassword.php b/bureau/admin/sql_users_dopassword.php new file mode 100644 index 00000000..f6998609 --- /dev/null +++ b/bureau/admin/sql_users_dopassword.php @@ -0,0 +1,42 @@ + array ("request", "string", ""), + "password" => array ("request", "string", ""), + "passwordconf" => array ("request", "string", ""), +); +getFields($fields); + +$mysql->change_user_password($id,$password,$passwordconf); + +include("sql_users_list.php"); + +?> diff --git a/bureau/admin/sql_users_list.php b/bureau/admin/sql_users_list.php index 75c3fede..677fd213 100644 --- a/bureau/admin/sql_users_list.php +++ b/bureau/admin/sql_users_list.php @@ -49,7 +49,7 @@ echo "

"._("help_sql_users_list_ok")."

";
- + + array ("request", "string", ""), +); +getFields($fields); + +$r=$mysql->get_user_dblist($id); + +?> +

user["login"]."_".$id ?>

+
+
+$error

 

"; + } + +?> + + + +
 
 
">">
+ + + + + + + + + + + +
+ " onclick="document.location='sql_users_list.php'"/> + " /> +
+
+ + diff --git a/bureau/class/m_mysql.php b/bureau/class/m_mysql.php index cecec4bc..153c8189 100644 --- a/bureau/class/m_mysql.php +++ b/bureau/class/m_mysql.php @@ -477,6 +477,38 @@ class m_mysql { return true; } + /* ------------------------------------------------------------ */ + /** + * Change a user's MySQL password + * @param $usern the username + * @param $password The password for this username + * @param $passconf The password confirmation + * @return TRUE if the password has been changed in MySQL or FALSE if an error occurred + **/ + function change_user_password($usern,$password,$passconf) { + global $db,$err,$quota,$mem,$cuid,$admin; + $err->log("mysql","add_user",$usern); + + $usern=trim($usern); + $user=addslashes($mem->user["login"]."_".$usern); + $pass=addslashes($password); + if ($password != $passconf || !$password) { + $err->raise("mysql",17); + return false; + } + + // Check this password against the password policy using common API : + if (is_callable(array($admin,"checkPolicy"))) { + if (!$admin->checkPolicy("mysql",$user,$password)) { + return false; // The error has been raised by checkPolicy() + } + } + + $db->query("SET PASSWORD FOR '$user'@'$this->client' = PASSWORD('$pass')"); + return true; + } + + /* ------------------------------------------------------------ */ /**