diff options
Diffstat (limited to 'actions/finishopenidlogin.php')
-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)) { |