From: Evan Prodromou Date: Wed, 3 Dec 2008 18:50:22 +0000 (-0500) Subject: don't allow new users if the site is closed or invite only in OpenID X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6c9031cc7bfc53e23b5512ee7bb5c216c1e99108;p=quix0rs-gnu-social.git don't allow new users if the site is closed or invite only in OpenID darcs-hash:20081203185022-5ed1f-a618527f069301c34b3fd6a75ae5676f45e64d39.gz --- diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index 79bcd3f319..8ac8363983 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)) {