mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-02-20 10:18 am

[dw-free] LJ::Identity incorrectly uses typeid 0 (zero) for OpenID accounts instead of 'O'

[commit: http://hg.dwscoalition.org/dw-free/rev/168d616a4dda]

http://bugs.dwscoalition.org/show_bug.cgi?id=250

Use 'O' instead of 0 for OpenID account types. (Database uses 'O'.)

Patch by Andrea Nall <anall@andreanall.com>.

--------------------------------------------------------------------------------
diff -r 083a0e1d9dc2 -r 168d616a4dda cgi-bin/LJ/Identity.pm
--- a/cgi-bin/LJ/Identity.pm	Fri Feb 20 10:16:49 2009 +0000
+++ b/cgi-bin/LJ/Identity.pm	Fri Feb 20 10:18:51 2009 +0000
@@ -3,7 +3,7 @@ use strict;
 use strict;
 
 use fields (
-            'typeid',  # Id number of identity type
+            'typeid',  # character defining identity type
             'value',   # Identity string
             );
 
@@ -20,7 +20,7 @@ sub new {
 
 sub pretty_type {
     my LJ::Identity $self = shift;
-    return 'OpenID' if $self->{typeid} == 0;
+    return 'OpenID' if $self->{typeid} eq 'O';
     return 'Invalid identity type';
 }
 
diff -r 083a0e1d9dc2 -r 168d616a4dda cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Fri Feb 20 10:16:49 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Fri Feb 20 10:18:51 2009 +0000
@@ -1167,7 +1167,7 @@ sub url {
 
     if ($u->{'journaltype'} eq "I" && ! $u->{url}) {
         my $id = $u->identity;
-        if ($id && $id->typeid == 0) {
+        if ($id && $id->typeid eq 'O') {
             $url = $id->value;
             $u->set_prop("url", $url) if $url;
         }
@@ -1217,7 +1217,7 @@ sub openid_identity {
 sub openid_identity {
     my $u = shift;
     my $ident = $u->identity;
-    return undef unless $ident && $ident->typeid == 0;
+    return undef unless $ident && $ident->typeid eq 'O';
     return $ident->value;
 }
 
@@ -1230,7 +1230,7 @@ sub display_name {
     return "[ERR:unknown_identity]" unless $id;
 
     my ($url, $name);
-    if ($id->typeid == 0) {
+    if ($id->typeid eq 'O') {
         require Net::OpenID::Consumer;
         $url = $id->value;
         $name = Net::OpenID::VerifiedIdentity::DisplayOfURL($url, $LJ::IS_DEV_SERVER);
@@ -1256,7 +1256,7 @@ sub ljuser_display {
 
     my ($url, $name);
 
-    if ($id->typeid == 0) {
+    if ($id->typeid eq 'O') {
         $url = $journal_url ne '' ? $journal_url : $id->value;
         $name = $u->display_name;
 
--------------------------------------------------------------------------------