summaryrefslogtreecommitdiff
path: root/plugins/OpenID
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-05-27 14:57:32 -0700
committerBrion Vibber <brion@pobox.com>2010-05-27 14:57:32 -0700
commit696aeea113b88fd0f6b7c4c88eebc2f4f369d245 (patch)
treec16f91a270c2989f8e6b3799b2dfa3e39698f565 /plugins/OpenID
parentcc25ec175530a691686087db4c23a1a28ffd1b62 (diff)
parent2f2fa100715f9c09b2b91a2d1afddacf7b7f16db (diff)
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
Conflicts: lib/language.php plugins/OpenID/finishaddopenid.php
Diffstat (limited to 'plugins/OpenID')
-rw-r--r--plugins/OpenID/finishaddopenid.php13
-rw-r--r--plugins/OpenID/finishopenidlogin.php10
-rw-r--r--plugins/OpenID/openid.php11
3 files changed, 24 insertions, 10 deletions
diff --git a/plugins/OpenID/finishaddopenid.php b/plugins/OpenID/finishaddopenid.php
index e07ab764e..47b3f7fb1 100644
--- a/plugins/OpenID/finishaddopenid.php
+++ b/plugins/OpenID/finishaddopenid.php
@@ -138,13 +138,16 @@ class FinishaddopenidAction extends Action
$this->message(_m('Error connecting user.'));
return;
}
- if ($sreg) {
- if (!oid_update_user($cur, $sreg)) {
- // TRANS: message in case the user or the user profile cannot be saved in StatusNet.
- $this->message(_m('Error updating profile'));
- return;
+ if (Event::handle('StartOpenIDUpdateUser', array($cur, $canonical, &$sreg))) {
+ if ($sreg) {
+ if (!oid_update_user($cur, $sreg)) {
+ // TRANS: message in case the user or the user profile cannot be saved in StatusNet.
+ $this->message(_m('Error updating profile'));
+ return;
+ }
}
}
+ Event::handle('EndOpenIDUpdateUser', array($cur, $canonical, $sreg));
// success!
diff --git a/plugins/OpenID/finishopenidlogin.php b/plugins/OpenID/finishopenidlogin.php
index a9ab14199..0c03b5c4d 100644
--- a/plugins/OpenID/finishopenidlogin.php
+++ b/plugins/OpenID/finishopenidlogin.php
@@ -310,6 +310,8 @@ class FinishopenidloginAction extends Action
return;
}
+ Event::handle('StartOpenIDCreateNewUser', array($canonical, &$sreg));
+
$location = '';
if (!empty($sreg['country'])) {
if ($sreg['postcode']) {
@@ -349,6 +351,8 @@ class FinishopenidloginAction extends Action
$result = oid_link_user($user->id, $canonical, $display);
+ Event::handle('EndOpenIDCreateNewUser', array($user, $canonical, $sreg));
+
oid_set_last($display);
common_set_user($user);
common_real_login(true);
@@ -391,7 +395,11 @@ class FinishopenidloginAction extends Action
return;
}
- oid_update_user($user, $sreg);
+ if (Event::handle('StartOpenIDUpdateUser', array($user, $canonical, &$sreg))) {
+ oid_update_user($user, $sreg);
+ }
+ Event::handle('EndOpenIDUpdateUser', array($user, $canonical, $sreg));
+
oid_set_last($display);
common_set_user($user);
common_real_login(true);
diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php
index 4dc924695..68851f4eb 100644
--- a/plugins/OpenID/openid.php
+++ b/plugins/OpenID/openid.php
@@ -230,11 +230,14 @@ function _oid_print_instructions()
'OpenID provider.'));
}
-# update a user from sreg parameters
-
-function oid_update_user(&$user, &$sreg)
+/**
+ * Update a user from sreg parameters
+ * @param User $user
+ * @param array $sreg fields from OpenID sreg response
+ * @access private
+ */
+function oid_update_user($user, $sreg)
{
-
$profile = $user->getProfile();
$orig_profile = clone($profile);