aboutsummaryrefslogtreecommitdiff
path: root/actions/admin/user/resetpassword.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/admin/user/resetpassword.php')
-rw-r--r--actions/admin/user/resetpassword.php26
1 files changed, 14 insertions, 12 deletions
diff --git a/actions/admin/user/resetpassword.php b/actions/admin/user/resetpassword.php
index aead052dd..c70410201 100644
--- a/actions/admin/user/resetpassword.php
+++ b/actions/admin/user/resetpassword.php
@@ -1,26 +1,29 @@
<?php
/**
- * Admin password reset.
+ * Reset a user's password.
*
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
+ * This is an admin action that generates a new salt and password
+ * for a user, then emails the password to the user's registered
+ * email address.
+ *
+ * NOTE: This is different to the "reset password" link users
+ * can use in that it does not first email the user asking if
+ * they want to have their password reset.
+ *
+ * @package Elgg.Core
+ * @subpackage Administration.User
*/
-global $CONFIG;
-
-// block non-admin users
admin_gatekeeper();
-// Get the user
$guid = get_input('guid');
$obj = get_entity($guid);
if (($obj instanceof ElggUser) && ($obj->canEdit())) {
$password = generate_random_cleartext_password();
- $obj->salt = generate_random_cleartext_password(); // Reset the salt
+ // Always reset the salt before generating the user password.
+ $obj->salt = generate_random_cleartext_password();
$obj->password = generate_user_password($obj, $password);
if ($obj->save()) {
@@ -39,5 +42,4 @@ if (($obj instanceof ElggUser) && ($obj->canEdit())) {
register_error(elgg_echo('admin:user:resetpassword:no'));
}
-forward($_SERVER['HTTP_REFERER']);
-exit;
+forward($_SERVER['HTTP_REFERER']); \ No newline at end of file