]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2454: Merged [6920] to trunk.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 24 Sep 2010 18:17:54 +0000 (18:17 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 24 Sep 2010 18:17:54 +0000 (18:17 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6962 36083f99-b078-4883-b0ff-0f9b5a30f544

actions/register.php
languages/en.php

index b5733635fcd2ea7ec2645bf1063953d688132dae..a5043fed93822e76f390ba59166fc32e31170815 100644 (file)
@@ -25,11 +25,21 @@ if (is_array($admin)) {
 }
 
 if ($CONFIG->allow_registration) {
-// For now, just try and register the user
        try {
+               if (trim($password) == "" || trim($password2) == "") {
+                       throw new RegistrationException(elgg_echo('RegistrationException:EmptyPassword'));
+               }
+
+               if (strcmp($password, $password2) != 0) {
+                       throw new RegistrationException(elgg_echo('RegistrationException:PasswordMismatch'));
+               }
+
                $guid = register_user($username, $password, $name, $email, false, $friend_guid, $invitecode);
-               if (((trim($password) != "") && (strcmp($password, $password2) == 0)) && ($guid)) {
+               if ($guid) {
                        $new_user = get_entity($guid);
+
+                       // @todo - consider removing registering admins since this is done
+                       // through the useradd action
                        if (($guid) && ($admin)) {
                                // Only admins can make someone an admin
                                admin_gatekeeper();
index 6a3f0d34af8caa5415529ed81775b30c398fadd0..797cfee7aa93a01c6f0b99d84a8c870ea61d3bcb 100644 (file)
@@ -179,6 +179,9 @@ $english = array(
 
        'SecurityException:deletedisablecurrentsite' => 'You can not delete or disable the site you are currently viewing!',
 
+       'RegistrationException:EmptyPassword' => 'The password fields cannot be empty',
+       'RegistrationException:PasswordMismatch' => 'Passwords must match',
+
        'memcache:notinstalled' => 'PHP memcache module not installed, you must install php5-memcache',
        'memcache:noservers' => 'No memcache servers defined, please populate the $CONFIG->memcache_servers variable',
        'memcache:versiontoolow' => 'Memcache needs at least version %s to run, you are running %s',