diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-12 13:28:55 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-12 13:28:55 +0000 |
commit | 36ced79b9dfaeb4fcd3f5bc6e4d3fd2b25c19d2f (patch) | |
tree | ab89c83745ead98d010196d85b899e12ab1b011d /actions | |
parent | 79916b49fbea384981eba250080ce92a61d4c350 (diff) | |
download | elgg-36ced79b9dfaeb4fcd3f5bc6e4d3fd2b25c19d2f.tar.gz elgg-36ced79b9dfaeb4fcd3f5bc6e4d3fd2b25c19d2f.tar.bz2 |
Refs #229 : Register now has more granular messages, dupe email checkiong, sanitisation + fill in the blanks failure mode! (yay)
git-svn-id: https://code.elgg.org/elgg/trunk@1855 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions')
-rw-r--r-- | actions/register.php | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/actions/register.php b/actions/register.php index 43a653b3f..17b6fa169 100644 --- a/actions/register.php +++ b/actions/register.php @@ -29,27 +29,40 @@ if (!$CONFIG->disable_registration) {
- // 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)) - { - admin_gatekeeper(); // Only admins can make someone an admin - $new_user = get_entity($guid); - $new_user->admin = 'yes'; + // For now, just try and register the user + + try {
+ if ( + ( + (trim($password)!="") && + (strcmp($password, $password2)==0) + ) && + ($guid = register_user($username, $password, $name, $email)) + ) { + if (($guid) && ($admin)) + { + admin_gatekeeper(); // Only admins can make someone an admin + $new_user = get_entity($guid); + $new_user->admin = 'yes'; + } +
+ system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename)); + + forward(); // Forward on success, assume everything else is an error...
+ } else {
+ register_error(elgg_echo("registerbad"));
} -
- system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename));
- } else {
- register_error(elgg_echo("registerbad"));
+ } catch (RegistrationException $r) { + register_error($r->getMessage()); } } else - register_error(elgg_echo('registerdisabled'));
+ register_error(elgg_echo('registerdisabled')); + + $qs = explode('?',$_SERVER['HTTP_REFERER']); + $qs = $qs[0]; + $qs .= "?u=" . urlencode($username) . "&e=" . urlencode($email) . "&n=" . urlencode($name); + + forward($qs);
?>
\ No newline at end of file |