[Bps-public-commit] r18748 - RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler

ruz at bestpractical.com ruz at bestpractical.com
Mon Mar 9 16:13:41 EDT 2009


Author: ruz
Date: Mon Mar  9 16:13:39 2009
New Revision: 18748

Modified:
   RT-Authen-Bitcard/html/Callbacks/Bitcard/autohandler/Auth

Log:
* don't try to use name on create if it's already in use

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	Mon Mar  9 16:13:39 2009
@@ -54,9 +54,19 @@
       return;
   }
 
+  # No user with this email in the DB, let's create it
+
+  # first of all check if username is free then create a new user
+  my $login_is_free = 0;
+  {
+      my $UserObj = RT::User->new( $RT::SystemUser );
+      $UserObj->Load( $user->{'username'} );
+      $login_is_free = $UserObj->id? 0 : 1;
+  }
+
   my $UserObj = RT::User->new( $RT::SystemUser );
   my ($id, $msg) = $UserObj->Create(
-      Name         => $user->{'username'},
+      Name         => $login_is_free? $user->{'username'}: $user->{'email'},
       RealName     => $user->{'name'},
       EmailAddress => $user->{'email'},
       Privileged   => 1,



More information about the Bps-public-commit mailing list