aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/register.php3
-rw-r--r--actions/useradd.php34
2 files changed, 22 insertions, 15 deletions
diff --git a/actions/register.php b/actions/register.php
index 17b6fa169..38d1893b9 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -45,6 +45,9 @@
$new_user = get_entity($guid);
$new_user->admin = 'yes';
}
+
+ // Send email validation on register only
+ request_email_validation($guid);
system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename));
diff --git a/actions/useradd.php b/actions/useradd.php
index cdd9adcf7..f7a96b037 100644
--- a/actions/useradd.php
+++ b/actions/useradd.php
@@ -27,23 +27,27 @@
if (is_array($admin)) $admin = $admin[0];
// For now, just try and register the user
- if (
- (
- (trim($password)!="") &&
- (strcmp($password, $password2)==0)
- ) &&
- ($guid = register_user($username, $password, $name, $email))
- ) {
- if (($guid) && ($admin))
- {
+ try {
+ if (
+ (
+ (trim($password)!="") &&
+ (strcmp($password, $password2)==0)
+ ) &&
+ ($guid = register_user($username, $password, $name, $email, true))
+ ) {
+ if (($guid) && ($admin))
+ {
+
+ $new_user = get_entity($guid);
+ $new_user->admin = 'yes';
+ }
- $new_user = get_entity($guid);
- $new_user->admin = 'yes';
+ system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename));
+ } else {
+ register_error(elgg_echo("adduser:bad"));
}
-
- system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename));
- } else {
- register_error(elgg_echo("adduser:bad"));
+ } catch (RegistrationException $r) {
+ register_error($r->getMessage());
}
forward($_SERVER['HTTP_REFERER']);