diff options
Diffstat (limited to 'actions/useradd.php')
-rw-r--r-- | actions/useradd.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/actions/useradd.php b/actions/useradd.php index 8e588d073..3df41af79 100644 --- a/actions/useradd.php +++ b/actions/useradd.php @@ -20,13 +20,24 @@ 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)) { + if ($uew_user && $admin && elgg_is_admin_logged_in()) { $new_user->makeAdmin(); } |