OpenID fixes:

- avoid notice spew when checking sreg items that weren't provided
- fix keys spec for user_openid, clears up problems with removing openid associations
- fix keys spec for user_openid_trustroot
This commit is contained in:
Brion Vibber 2010-03-12 10:07:32 -08:00
parent f72eb17304
commit 4d7479dcbc
3 changed files with 13 additions and 3 deletions

View File

@ -44,6 +44,11 @@ class User_openid extends Memcached_DataObject
* Unique keys used for lookup *MUST* be listed to ensure proper caching.
*/
function keys()
{
return array_keys($this->keyTypes());
}
function keyTypes()
{
return array('canonical' => 'K', 'display' => 'U', 'user_id' => 'U');
}

View File

@ -42,6 +42,11 @@ class User_openid_trustroot extends Memcached_DataObject
}
function keys()
{
return array_keys($this->keyTypes());
}
function keyTypes()
{
return array('trustroot' => 'K', 'user_id' => 'K');
}

View File

@ -225,11 +225,11 @@ function oid_update_user(&$user, &$sreg)
$orig_profile = clone($profile);
if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) {
if (!empty($sreg['fullname']) && strlen($sreg['fullname']) <= 255) {
$profile->fullname = $sreg['fullname'];
}
if ($sreg['country']) {
if (!empty($sreg['country'])) {
if ($sreg['postcode']) {
# XXX: use postcode to get city and region
# XXX: also, store postcode somewhere -- it's valuable!
@ -249,7 +249,7 @@ function oid_update_user(&$user, &$sreg)
$orig_user = clone($user);
if ($sreg['email'] && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
if (!empty($sreg['email']) && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
$user->email = $sreg['email'];
}