From 4706f47ca0b19d9baa45742ae7c8d270c42e9490 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 5 Oct 2011 21:28:30 -0400 Subject: Fixes #3704 displaying error messages when adding users through admin interface --- actions/useradd.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'actions') 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(); -- cgit v1.2.3