aboutsummaryrefslogtreecommitdiff
path: root/actions/user
diff options
context:
space:
mode:
Diffstat (limited to 'actions/user')
-rw-r--r--actions/user/default_access.php35
-rw-r--r--actions/user/language.php31
-rw-r--r--actions/user/name.php36
-rw-r--r--actions/user/password.php37
-rw-r--r--actions/user/passwordreset.php2
-rw-r--r--actions/user/requestnewpassword.php7
-rw-r--r--actions/user/spotlight.php4
7 files changed, 7 insertions, 145 deletions
diff --git a/actions/user/default_access.php b/actions/user/default_access.php
deleted file mode 100644
index ae489dcbe..000000000
--- a/actions/user/default_access.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * Action for changing a user's default access level
- *
- * @package Elgg
- * @subpackage Core
- */
-
-global $CONFIG;
-
-if ($CONFIG->allow_user_default_access) {
- gatekeeper();
-
- $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 252263cd2..000000000
--- a/actions/user/language.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Action for changing a user's personal language settings
- *
- * @package Elgg
- * @subpackage Core
- */
-
-gatekeeper();
-
-$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 c3e79d725..000000000
--- a/actions/user/name.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Action for changing a user's name
- *
- * @package Elgg
- * @subpackage Core
- */
-
-gatekeeper();
-
-$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 ceb9d4585..000000000
--- a/actions/user/password.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Action for changing a user's password
- *
- * @package Elgg
- * @subpackage Core
- */
-
-gatekeeper();
-
-$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 != "")) {
- 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/passwordreset.php b/actions/user/passwordreset.php
index 230dfd68f..201d6abcf 100644
--- a/actions/user/passwordreset.php
+++ b/actions/user/passwordreset.php
@@ -6,8 +6,6 @@
* @subpackage Core
*/
-global $CONFIG;
-
$user_guid = get_input('u');
$code = get_input('c');
diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php
index 22b4008e8..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)) {
@@ -16,7 +21,7 @@ if ($user) {
register_error(elgg_echo('user:password:resetreq:fail'));
}
} else {
- register_error(sprintf(elgg_echo('user:username:notfound'), $username));
+ register_error(elgg_echo('user:username:notfound', array($username)));
}
forward();
diff --git a/actions/user/spotlight.php b/actions/user/spotlight.php
index 00525254b..202dde387 100644
--- a/actions/user/spotlight.php
+++ b/actions/user/spotlight.php
@@ -7,8 +7,6 @@
* @todo This is deprecated in 1.8
*/
-gatekeeper();
-
$closed = get_input('closed', 'true');
if ($closed != 'true') {
$closed = false;
@@ -16,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