[Rt-commit] r3555 - in RT-Authen-Bitcard: .
html/Callbacks/Bitcard/autohandler
kevinr at bestpractical.com
kevinr at bestpractical.com
Thu Jul 28 20:37:31 EDT 2005
Author: kevinr
Date: Thu Jul 28 20:37:31 2005
New Revision: 3555
Modified:
RT-Authen-Bitcard/ (props changed)
RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth
Log:
r6718 at SAD-GIRL-IN-SNOW: kevinr | 2005-07-28 20:36:43 -0400
* Fixed user-creation so it actually works (kinda)
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 Thu Jul 28 20:37:31 2005
@@ -7,7 +7,7 @@
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) {
+ if ( (! $session{'CurrentUser'}) && ($user) ) {
print "Verified user ". $user->{'email'}. '<br />';
@@ -22,22 +22,28 @@
}
else {
print "Couldn't load user; trying to create...";
- $session{'CurrentUser'}->Create(
- Name => $user->{'username'},
- RealName => $user->{'name'},
- EmailAddress => $user->{'email'},
- );
- if ( $session{'CurrentUser'}->id ) {
+ my $UserObj = RT::User->new($RT::SystemUser);
+ my ($id, $msg)
+ = $UserObj->Create(
+ Name => $user->{'username'},
+ RealName => $user->{'name'},
+ 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
- $m->redirect('User/Prefs.html');
+ # (are we creating privileged or unprivileged users?)
+ #$m->redirect('User/Prefs.html');
}
else {
# we couldn't create the user. abort abort abort!
+ print "Couldn't create user: $msg";
delete $session{'CurrentUser'};
$m->abort() unless $RT::WebFallbackToInternalAuth;
- $m->comp('/Elements/Login', %ARGS,
- Error => loc('Cannot create user: [_1]', $msg)
- );
}
}
}
More information about the Rt-commit
mailing list