aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-10-05 21:28:30 -0400
committercash <cash.costello@gmail.com>2011-10-05 21:28:30 -0400
commit4706f47ca0b19d9baa45742ae7c8d270c42e9490 (patch)
treea89a44d6138c448e0f26030096179369d9a4350d /actions
parent2be122cb5032567e88bb926b8aac250fd488cf68 (diff)
downloadelgg-4706f47ca0b19d9baa45742ae7c8d270c42e9490.tar.gz
elgg-4706f47ca0b19d9baa45742ae7c8d270c42e9490.tar.bz2
Fixes #3704 displaying error messages when adding users through admin interface
Diffstat (limited to 'actions')
-rw-r--r--actions/useradd.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/actions/useradd.php b/actions/useradd.php
index 8e588d073..be08b4be5 100644
--- a/actions/useradd.php
+++ b/actions/useradd.php
@@ -20,11 +20,22 @@ if (is_array($admin)) {
$admin = $admin[0];
}
+// no blank fields
+if ($username == '' || $password == '' || $password2 == '' || $email == '' || $name == '') {
+ register_error(elgg_echo('register:fields'));
+ forward(REFERER);
+}
+
+if (strcmp($password, $password2) != 0) {
+ register_error(elgg_echo('RegistrationException:PasswordMismatch'));
+ forward(REFERER);
+}
+
// For now, just try and register the user
try {
$guid = register_user($username, $password, $name, $email, TRUE);
- if (((trim($password) != "") && (strcmp($password, $password2) == 0)) && ($guid)) {
+ if ($guid) {
$new_user = get_entity($guid);
if (($guid) && ($admin)) {
$new_user->makeAdmin();