]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
don't allow new users if the site is closed or invite only in OpenID
authorEvan Prodromou <evan@controlyourself.ca>
Wed, 3 Dec 2008 18:50:22 +0000 (13:50 -0500)
committerEvan Prodromou <evan@controlyourself.ca>
Wed, 3 Dec 2008 18:50:22 +0000 (13:50 -0500)
darcs-hash:20081203185022-5ed1f-a618527f069301c34b3fd6a75ae5676f45e64d39.gz

actions/finishopenidlogin.php

index 79bcd3f319aabd4309b7bfab7a04c74686b4dab1..8ac83639839f7e6828372f5a36476b2f1e650900 100644 (file)
@@ -167,6 +167,13 @@ class FinishopenidloginAction extends Action {
 
        function create_new_user() {
 
+        # FIXME: save invite code before redirect, and check here
+
+               if (common_config('site', 'closed') || common_config('site', 'inviteonly')) {
+                       common_user_error(_('Registration not allowed.'));
+            return;
+        }
+
                $nickname = $this->trimmed('newname');
 
                if (!Validate::string($nickname, array('min_length' => 1,
@@ -211,27 +218,27 @@ class FinishopenidloginAction extends Action {
                                $location = $sreg['country'];
                        }
                }
-
+               
                if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
                        $fullname = $sreg['fullname'];
                }
-
+               
                if ($sreg['email'] && Validate::email($sreg['email'], true)) {
                        $email = $sreg['email'];
                }
 
                # XXX: add language
                # XXX: add timezone
-
-               $user = User::register(array('nickname' => $nickname,
+               
+               $user = User::register(array('nickname' => $nickname, 
                                                                         'email' => $email,
-                                                                        'fullname' => $fullname,
+                                                                        'fullname' => $fullname, 
                                                                         'location' => $location));
 
                $result = oid_link_user($user->id, $canonical, $display);
-
-               oid_set_last($display);
-               common_set_user($user);
+               
+               oid_set_last($display);                                                    
+               common_set_user($user->nickname);
                common_real_login(true);
         if (isset($_SESSION['openid_rememberme']) && $_SESSION['openid_rememberme']) {
                        common_rememberme($user);
@@ -296,6 +303,7 @@ class FinishopenidloginAction extends Action {
 
                # Try the passed-in nickname
 
+
                if ($sreg['nickname']) {
                        $nickname = $this->nicknamize($sreg['nickname']);
                        if ($this->is_new_nickname($nickname)) {