[Rt-commit] r3594 - in RT-Authen-Bitcard: .
html/Callbacks/Bitcard/NoAuth/Logout.html
html/Callbacks/Bitcard/autohandler
trs at bestpractical.com
trs at bestpractical.com
Wed Aug 3 13:49:46 EDT 2005
Author: trs
Date: Wed Aug 3 13:49:45 2005
New Revision: 3594
Added:
RT-Authen-Bitcard/html/Callbacks/Bitcard/NoAuth/Logout.html/AfterSessionDelete
RT-Authen-Bitcard/html/Callbacks/Bitcard/NoAuth/Logout.html/BeforeSessionDelete
Removed:
RT-Authen-Bitcard/html/Callbacks/Bitcard/NoAuth/Logout.html/Default
Modified:
RT-Authen-Bitcard/ (props changed)
RT-Authen-Bitcard/MANIFEST
RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth
Log:
r5604 at wintermute: tom | 2005-08-03 13:48:00 -0400
* Fixed the Logout.html callbacks so they're called and only
redirect user to the bitcard logout if it's a bitcard user.
* Updated MANIFEST
* Removed debugging messages (which I don't think we need anymore)
Modified: RT-Authen-Bitcard/MANIFEST
==============================================================================
--- RT-Authen-Bitcard/MANIFEST (original)
+++ RT-Authen-Bitcard/MANIFEST Wed Aug 3 13:49:45 2005
@@ -1,3 +1,7 @@
+html/Callbacks/Bitcard/autohandler/Auth
+html/Callbacks/Bitcard/Elements/Login/Default
+html/Callbacks/Bitcard/NoAuth/Logout.html/AfterSessionDelete
+html/Callbacks/Bitcard/NoAuth/Logout.html/BeforeSessionDelete
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
Added: RT-Authen-Bitcard/html/Callbacks/Bitcard/NoAuth/Logout.html/AfterSessionDelete
==============================================================================
--- (empty file)
+++ RT-Authen-Bitcard/html/Callbacks/Bitcard/NoAuth/Logout.html/AfterSessionDelete Wed Aug 3 13:49:45 2005
@@ -0,0 +1,16 @@
+<%INIT>
+ use Authen::Bitcard;
+
+ if ($m->notes('isBitcardUser')) {
+ my $bc = Authen::Bitcard->new;
+
+ die 'No Bitcard auth token provided as $BitcardToken in the RT configuration file.'
+ unless $RT::BitcardToken;
+
+ $bc->token($RT::BitcardToken);
+ my $return_url = $RT::WebURL;
+
+ $m->redirect( $bc->logout_url( r => $return_url ) );
+ $m->abort();
+ }
+</%INIT>
Added: RT-Authen-Bitcard/html/Callbacks/Bitcard/NoAuth/Logout.html/BeforeSessionDelete
==============================================================================
--- (empty file)
+++ RT-Authen-Bitcard/html/Callbacks/Bitcard/NoAuth/Logout.html/BeforeSessionDelete Wed Aug 3 13:49:45 2005
@@ -0,0 +1,6 @@
+<%INIT>
+if ($session{'BitcardUser'}) {
+ delete $session{'BitcardUser'};
+ $m->notes(isBitcardUser => 1);
+}
+</%INIT>
Modified: RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth
==============================================================================
--- RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth (original)
+++ RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth Wed Aug 3 13:49:45 2005
@@ -1,17 +1,15 @@
<%INIT>
use Authen::Bitcard;
my $bc = Authen::Bitcard->new;
- die 'No Bitcard auth token provided as $BitcardToken in the RT configuration file on this server.' unless $RT::BitcardToken;
+ die 'No Bitcard auth token provided as $BitcardToken in the RT configuration file on this server.'
+ unless $RT::BitcardToken;
$bc->token($RT::BitcardToken);
my $user = $bc->verify(\%ARGS);
- print "Could not verify user" unless ($user) || ( $session{'CurrentUser'} );
# if the user isn't logged in and we got credentials from Bitcard, load them
if ( (! $session{'CurrentUser'}) && ($user) ) {
- print "Verified user ". $user->{'email'}. '<br />';
-
# set a global user so we know elsewhere we're using Bitcard for auth
$session{'BitcardUser'} = $user;
@@ -21,11 +19,7 @@
# we've got a valid user, so try to load
$session{'CurrentUser'} = RT::CurrentUser->new();
$session{'CurrentUser'}->LoadByEmail( $user->{'email'} );
- if ( $session{'CurrentUser'}->id ) {
- print "Loaded user ". ( $session{'CurrentUser'} )->id;
- }
- else {
- print "Couldn't load user; trying to create...";
+ if ( not $session{'CurrentUser'}->id ) {
my $UserObj = RT::User->new($RT::SystemUser);
my ($id, $msg)
= $UserObj->Create(
@@ -34,9 +28,7 @@
EmailAddress => $user->{'email'},
);
if ( $UserObj->id ) {
-
# created the user, now load them as the current user
- print "Created user";
$session{'CurrentUser'}->Load($UserObj->id);
# redirect the user to their preference page to add more info
@@ -45,7 +37,6 @@
}
else {
# we couldn't create the user. abort abort abort!
- print "Couldn't create user: $msg";
delete $session{'CurrentUser'};
$m->abort() unless $RT::WebFallbackToInternalAuth;
}
More information about the Rt-commit
mailing list