diff options
Diffstat (limited to 'actions/user')
| -rw-r--r-- | actions/user/default_access.php | 33 | ||||
| -rw-r--r-- | actions/user/language.php | 29 | ||||
| -rw-r--r-- | actions/user/name.php | 34 | ||||
| -rw-r--r-- | actions/user/password.php | 49 | ||||
| -rw-r--r-- | actions/user/requestnewpassword.php | 5 | ||||
| -rw-r--r-- | actions/user/spotlight.php | 2 |
6 files changed, 6 insertions, 146 deletions
diff --git a/actions/user/default_access.php b/actions/user/default_access.php deleted file mode 100644 index 0c2390842..000000000 --- a/actions/user/default_access.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/** - * Action for changing a user's default access level - * - * @package Elgg - * @subpackage Core - */ - -global $CONFIG; - -if ($CONFIG->allow_user_default_access) { - $default_access = get_input('default_access'); - $user_id = get_input('guid'); - - if (!$user_id) { - $user = get_loggedin_user(); - } else { - $user = get_entity($user_id); - } - - if ($user) { - $current_default_access = $user->getPrivateSetting('elgg_default_access'); - if ($default_access !== $current_default_access) { - if ($user->setPrivateSetting('elgg_default_access', $default_access)) { - system_message(elgg_echo('user:default_access:success')); - } else { - register_error(elgg_echo('user:default_access:fail')); - } - } - } else { - register_error(elgg_echo('user:default_access:fail')); - } -} diff --git a/actions/user/language.php b/actions/user/language.php deleted file mode 100644 index 44c591d7a..000000000 --- a/actions/user/language.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * Action for changing a user's personal language settings - * - * @package Elgg - * @subpackage Core - */ - -$language = get_input('language'); -$user_id = get_input('guid'); - -if (!$user_id) { - $user = get_loggedin_user(); -} else { - $user = get_entity($user_id); -} - -if (($user) && ($language)) { - if (strcmp($language, $user->language) != 0) { - $user->language = $language; - if ($user->save()) { - system_message(elgg_echo('user:language:success')); - } else { - register_error(elgg_echo('user:language:fail')); - } - } -} else { - register_error(elgg_echo('user:language:fail')); -} diff --git a/actions/user/name.php b/actions/user/name.php deleted file mode 100644 index e293d409c..000000000 --- a/actions/user/name.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -/** - * Action for changing a user's name - * - * @package Elgg - * @subpackage Core - */ - -$name = strip_tags(get_input('name')); -$user_id = get_input('guid'); - -if (!$user_id) { - $user = get_loggedin_user(); -} else { - $user = get_entity($user_id); -} - -if (elgg_strlen($name) > 50) { - register_error(elgg_echo('user:name:fail')); - forward(REFERER); -} - -if (($user) && ($user->canEdit()) && ($name)) { - if ($name != $user->name) { - $user->name = $name; - if ($user->save()) { - system_message(elgg_echo('user:name:success')); - } else { - register_error(elgg_echo('user:name:fail')); - } - } -} else { - register_error(elgg_echo('user:name:fail')); -} diff --git a/actions/user/password.php b/actions/user/password.php deleted file mode 100644 index bbeb0ea7f..000000000 --- a/actions/user/password.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Action for changing a user's password - * - * @package Elgg - * @subpackage Core - */ - -$current_password = get_input('current_password'); -$password = get_input('password'); -$password2 = get_input('password2'); -$user_id = get_input('guid'); - -if (!$user_id) { - $user = get_loggedin_user(); -} else { - $user = get_entity($user_id); -} - -if (($user) && ($password != "")) { - // let admin user change anyone's password without knowing it except his own. - if (!isadminloggedin() || isadminloggedin() && $user->guid == get_loggedin_userid()) { - $credentials = array( - 'username' => $user->username, - 'password' => $current_password - ); - - if (!pam_auth_userpass($credentials)) { - register_error(elgg_echo('user:password:fail:incorrect_current_password')); - forward(REFERER); - } - } - - if (strlen($password) >= 4) { - if ($password == $password2) { - $user->salt = generate_random_cleartext_password(); // Reset the salt - $user->password = generate_user_password($user, $password); - if ($user->save()) { - system_message(elgg_echo('user:password:success')); - } else { - register_error(elgg_echo('user:password:fail')); - } - } else { - register_error(elgg_echo('user:password:fail:notsame')); - } - } else { - register_error(elgg_echo('user:password:fail:tooshort')); - } -} diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php index 5dfa24952..f1d4fa43c 100644 --- a/actions/user/requestnewpassword.php +++ b/actions/user/requestnewpassword.php @@ -8,6 +8,11 @@ $username = get_input('username'); +// allow email addresses +if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) { + $username = $users[0]->username; +} + $user = get_user_by_username($username); if ($user) { if (send_new_password_request($user->guid)) { diff --git a/actions/user/spotlight.php b/actions/user/spotlight.php index 390197e78..202dde387 100644 --- a/actions/user/spotlight.php +++ b/actions/user/spotlight.php @@ -14,6 +14,6 @@ if ($closed != 'true') { $closed = true; } -get_loggedin_user()->spotlightclosed = $closed; +elgg_get_logged_in_user_entity()->spotlightclosed = $closed; // exit as this action is called through Ajax exit;
\ No newline at end of file |
