aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-03 02:01:08 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-03 02:01:08 +0000
commit11861a84c4ea8c462c735a6652caa0f3eee7bca7 (patch)
tree12dbc36e25bf26f43a51dfe69b988cb257fd5836 /engine/lib/users.php
parentec625722feb4da50848aac0b627b83b3bb0460a8 (diff)
downloadelgg-11861a84c4ea8c462c735a6652caa0f3eee7bca7.tar.gz
elgg-11861a84c4ea8c462c735a6652caa0f3eee7bca7.tar.bz2
Set admin user's validation upon initial registration.
Fixes an incorrect error message if the first admin user enters the wrong password. git-svn-id: http://code.elgg.org/elgg/trunk@3784 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 801eb862b..7ef9e2fda 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -154,7 +154,7 @@ class ElggUser extends ElggEntity
*/
public function delete() {
global $USERNAME_TO_GUID_MAP_CACHE, $CODE_TO_GUID_MAP_CACHE;
-
+
// clear cache
if (isset($USERNAME_TO_GUID_MAP_CACHE[$this->username])) {
unset($USERNAME_TO_GUID_MAP_CACHE[$this->username]);
@@ -162,7 +162,7 @@ class ElggUser extends ElggEntity
if (isset($CODE_TO_GUID_MAP_CACHE[$this->code])) {
unset($CODE_TO_GUID_MAP_CACHE[$this->code]);
}
-
+
// Delete owned data
clear_annotations_by_owner($this->guid);
clear_metadata_by_owner($this->guid);
@@ -481,11 +481,11 @@ function ban_user($user_guid, $reason = "") {
if ($reason) {
create_metadata($user_guid, 'ban_reason', $reason,'', 0, ACCESS_PUBLIC);
}
-
+
// clear "remember me" cookie code so user cannot login in using it
$user->code = "";
$user->save();
-
+
// Set ban flag
return update_data("UPDATE {$CONFIG->dbprefix}users_entity set banned='yes' where guid=$user_guid");
}
@@ -1269,7 +1269,7 @@ function register_user($username, $password, $name, $email, $allow_multiple_emai
// Check to see if we've registered the first admin yet.
// If not, this is the first admin user!
- $admin = datalist_get('admin_registered');
+ $have_admin = datalist_get('admin_registered');
// Otherwise ...
$user = new ElggUser();
@@ -1294,9 +1294,10 @@ function register_user($username, $password, $name, $email, $allow_multiple_emai
}
global $registering_admin;
- if (!$admin) {
+ if (!$have_admin) {
$user->admin = true;
- datalist_set('admin_registered',1);
+ $user->validated = 'admin';
+ datalist_set('admin_registered', 1);
$registering_admin = true;
} else {
$registering_admin = false;