[Jifty-commit] r4583 -
jifty/trunk/lib/Jifty/Plugin/Authentication/CAS/Action
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Nov 30 14:37:57 EST 2007
Author: yves
Date: Fri Nov 30 14:37:56 2007
New Revision: 4583
Modified:
jifty/trunk/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogin.pm
Log:
allow authentication by mail or cas login and domain
Modified: jifty/trunk/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogin.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogin.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogin.pm Fri Nov 30 14:37:56 2007
@@ -87,9 +87,14 @@
return;
};
+ my ($name,$email);
+ #TODO add a ldap conf to find name and email
+ $email = $username.'@'.$plugin->domain() if ($plugin->domain());
+
# Load up the user
my $current_user = Jifty->app_class('CurrentUser');
- my $user = $current_user->new( cas_id => $username );
+ my $user = ($email) ? $current_user->new( email => $email) # load by email to mix authentication
+ : $current_user->new( cas_id => $username ); # else load by cas_id
# Autocreate the user if necessary
if ( not $user->id ) {
@@ -113,12 +118,10 @@
my $u = $user->user_object;
- my ($name,$email);
- #TODO add a ldap conf to find name and email
- $email = $username.'@'.$plugin->domain() if ($plugin->domain());
- $u->__set( column => 'name', value => $username ) if (!$u->name);
# Update, just in case
+ $u->__set( column => 'cas_id', value => $username ) if (!$u->cas_id);
+ $u->__set( column => 'name', value => $username ) if (!$u->name);
$u->__set( column => 'name', value => $name ) if ($name);
$u->__set( column => 'email', value => $email ) if ($email);
More information about the Jifty-commit
mailing list