summaryrefslogtreecommitdiff
path: root/actions/finishopenidlogin.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-05-25 22:47:23 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-05-25 22:47:23 -0400
commit76aa85fe5ef408cecf7c40c0c56d58ff9ac9fcbb (patch)
treef2bd52d08e421f934bc8466ab1ecb4facbbcc6a5 /actions/finishopenidlogin.php
parentb140bcdee4b1f4c8f2f34a89a9c5c51e7ecfe826 (diff)
parent68d90bcab04713d53cf3731d45729a617e68a2fa (diff)
Merge branch '0.8.x' into stats
Conflicts: README
Diffstat (limited to 'actions/finishopenidlogin.php')
-rw-r--r--actions/finishopenidlogin.php33
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);