diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2008-12-03 13:50:22 -0500 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2008-12-03 13:50:22 -0500 |
commit | 6c9031cc7bfc53e23b5512ee7bb5c216c1e99108 (patch) | |
tree | 1fa19a300fba9f2b3e55371fd7dc24694c97c087 | |
parent | 301f5a176cf734ba4ee9c37e04b9ffbb3896dbee (diff) |
don't allow new users if the site is closed or invite only in OpenID
darcs-hash:20081203185022-5ed1f-a618527f069301c34b3fd6a75ae5676f45e64d39.gz
-rw-r--r-- | actions/finishopenidlogin.php | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index 79bcd3f31..8ac836398 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -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)) { |