[Jifty-commit] r4675 - jifty/trunk/lib/Jifty/Plugin/Authentication/Ldap/Action

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Dec 13 05:47:29 EST 2007


Author: yves
Date: Thu Dec 13 05:47:25 2007
New Revision: 4675

Modified:
   jifty/trunk/lib/Jifty/Plugin/Authentication/Ldap/Action/LDAPLogin.pm

Log:
mixin ldap authentication by email


Modified: jifty/trunk/lib/Jifty/Plugin/Authentication/Ldap/Action/LDAPLogin.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Authentication/Ldap/Action/LDAPLogin.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Authentication/Ldap/Action/LDAPLogin.pm	Thu Dec 13 05:47:25 2007
@@ -79,8 +79,15 @@
     }
 
     # Load up the user
+    my $infos =  $plugin->get_infos($username);
+    my $name = $infos->{name};
+    my $email = $infos->{email};
+ 
     my $current_user = Jifty->app_class('CurrentUser');
-    my $user = $current_user->new( ldap_id => $username );
+    my $user = ($email) 
+        ? $current_user->new( email => $email)    # load by email to mix authentication
+        : $current_user->new( ldap_id => $username );  # else load by ldap_id
+
 
     # Autocreate the user if necessary
     if ( not $user->id ) {
@@ -102,9 +109,6 @@
         $user = $current_user->new( ldap_id => $username );
     }
 
-    my $infos =  $plugin->get_infos($username);
-    my $name = $infos->{name};
-    my $email = $infos->{email};
     my $u = $user->user_object;
 
     # Update, just in case


More information about the Jifty-commit mailing list