diff options
author | Robin Millette <millette@controlyourself.ca> | 2009-04-18 21:14:31 +0000 |
---|---|---|
committer | Robin Millette <millette@controlyourself.ca> | 2009-04-18 21:14:31 +0000 |
commit | 39c0e3a9ef9c0d82eb5fae54d2aa422e281b24a1 (patch) | |
tree | 9344f6e279f0e6920074a66312d3cb404e362432 /actions/finishopenidlogin.php | |
parent | cb645558a511e0f4a03923a988bda78ceae5ff0d (diff) | |
parent | eec323b5b706b84039b3ead6e7ab8d4d6b666f1a (diff) |
fix 0.7.x 0.8.x merge conflict in register.php
Diffstat (limited to 'actions/finishopenidlogin.php')
-rw-r--r-- | actions/finishopenidlogin.php | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index 952185742..b08b96df6 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -191,11 +191,28 @@ class FinishopenidloginAction extends Action { # FIXME: save invite code before redirect, and check here - if (common_config('site', 'closed') || common_config('site', 'inviteonly')) { + if (common_config('site', 'closed')) { $this->clientError(_('Registration not allowed.')); return; } + $invite = null; + + if (common_config('site', 'inviteonly')) { + $code = $_SESSION['invitecode']; + if (empty($code)) { + $this->clientError(_('Registration not allowed.')); + return; + } + + $invite = Invitation::staticGet($code); + + if (empty($invite)) { + $this->clientError(_('Not a valid invitation code.')); + return; + } + } + $nickname = $this->trimmed('newname'); if (!Validate::string($nickname, array('min_length' => 1, @@ -257,10 +274,16 @@ class FinishopenidloginAction extends Action # XXX: add language # XXX: add timezone - $user = User::register(array('nickname' => $nickname, - 'email' => $email, - 'fullname' => $fullname, - 'location' => $location)); + $args = array('nickname' => $nickname, + 'email' => $email, + 'fullname' => $fullname, + 'location' => $location); + + if (!empty($invite)) { + $args['code'] = $invite->code; + } + + $user = User::register($args); $result = oid_link_user($user->id, $canonical, $display); |