aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index c0c43cb2f..b3ed4be55 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -811,6 +811,19 @@
return $valid;
}
+
+ /**
+ * Generate a password for a user, currently uses MD5.
+ *
+ * Later may introduce salting etc.
+ *
+ * @param ElggUser $user The user this is being generated for.
+ * @param string $password Password in clear text
+ */
+ function generate_user_password(ElggUser $user, $password)
+ {
+ return md5($password);
+ }
/**
* Registers a user, returning false if the username already exists
@@ -846,10 +859,10 @@
// Otherwise ...
$user = new ElggUser();
$user->username = $username;
- $user->password = md5($password);
$user->email = $email;
$user->name = $name;
- $user->access_id = 2;
+ $user->access_id = 2;
+ $user->password = generate_user_password($user, $password);
$user->save();
if (!$admin) {
@@ -906,6 +919,10 @@
extend_elgg_settings_page('user/settings/name', 'usersettings/user', 1);
register_action("user/name");
+ // User password change
+ extend_elgg_settings_page('user/settings/password', 'usersettings/user', 1);
+ register_action("user/password");
+
// Add email settings
extend_elgg_settings_page('user/settings/email', 'usersettings/user', 1);
register_action("email/save");