Registration page

Has anyone completed an online registration page for RT? This is my current
project and I was wondering if there was any example code out there. I have
already created all the basics, but I am stuck when all the information is
submitted. I have been trying to use the User->Create method. I’ll post
some of my code if anyone has any ideas.
thanks,
-FS

At 10:57 AM 12/2/2002 -0800, Forrest Stanley wrote:

Has anyone completed an online registration page for RT? This is my
current project and I was wondering if there was any example code out
there. I have already created all the basics, but I am stuck when all the
information is submitted. I have been trying to use the User->Create
method. I’ll post some of my code if anyone has any ideas.
thanks,
-FS

I managed to hack out a registration page this morning. Keep in mind that
this is undertested code, and may contain errors. I suggest you do your own
testing and modifications before you try any of this. Also, if anyone see’s
any glaring mistakes, please point them out to me :slight_smile:
-FS

Here’s what I did:

/lib/RT/User.pm (around line 128) <comment out ACL checks when creating a
User (allow anyone to create user)>

     #Check the ACL
     #unless ($self->CurrentUserHasRight('AdminUsers')) {
     #       return (0, 'No permission to create users');
     # }

/WebRT/html/Elements/Login (around line 18)

     - <TD ALIGN=RIGHT>Username:</TD><TD ALIGN=LEFT><input name=user 

value="<%$user%>">
+

Username: register

----------------/WebRT/html/NoAuth/registration.html----------------
<& /Elements/Header, Title=>‘Registration’ &>
<& /Elements/ListActions, actions => @results &>

Return to Login Page
<& /Elements/TitleBoxStart, title => 'Identity' &> Username:
Email:
Real Name:
Nickname:
Unix login:
Extra info: <& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxStart, title => 'Access control' &>
New Password:
Retype Password:
<& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxStart, title => 'Location' &> Organization:
Address1:
Address2:
City: State: Zip:
Country:

<& /Elements/TitleBoxEnd &>

<& /Elements/TitleBoxStart, title => ‘Phone numbers’ &>
Residence:
Work:
Mobile:
Pager:
<& /Elements/TitleBoxEnd &>



<& /Elements/Submit &>

<%INIT>
my @results;
if ($NewPass1) {
if ($NewPass1 ne $NewPass2) {
push (@results, “Passwords did not match.”);
}
else {
$Password = $NewPass1;
}
}
my $user_obj = new RT::User($session{‘CurrentUser’});
if ($UserName && $Password && $RealName && $EmailAddress) {
$Comments = “User created via Web Registration”;
$Privileged = 1;
my ($status, $msg) =
$user_obj->Create( Name => $UserName,
Gecos => $Gecos,
Password => $Password,
EmailAddress => $EmailAddress,
Privileged => $Privileged,
Comments => $Comments,
Organization => $Organization,
RealName => $RealName,
NickName => $NickName,
HomePhone => $HomePhone,
WorkPhone => $WorkPhone,
MobilePhone => $MobilePhone,
PagerPhone => $PagerPhone,
Address1 => $Address1,
Address2 => $Address2,
City => $City,
State => $State,
Zip => $Zip,
Country => $Country,
FreeformContactInfo => $FreeformContactInfo,
);
push (@results, $msg);
}
else {
if (!$UserName) { push (@results, “Required Field: Username\n”) };
if (!$RealName) { push (@results, “Required Field: Real Name\n”) };
if (!$EmailAddress) { push (@results, “Required Field: Email\n”) };
}
$session{‘i’}++;
</%INIT>

<%ARGS>
$UserName => undef
$EmailAddress => undef
$FreeformContactInfo => undef
$Organization => undef
$RealName => undef
$NickName => undef
$Lang => undef
$Gecos => undef
$HomePhone => undef
$WorkPhone => undef
$MobilePhone => undef
$PagerPhone => undef
$Address1 => undef
$Address2 => undef
$City => undef
$State => undef
$Zip => undef
$Country => undef
$NewPass1 => undef
$NewPass2=> undef
$Password => undef
$Comments => undef
$Privileged => undef
</%ARGS>

I managed to hack out a registration page this morning. Keep in mind that
this is undertested code, and may contain errors. I suggest you do your own
testing and modifications before you try any of this. Also, if anyone see’s
any glaring mistakes, please point them out to me :slight_smile:
-FS

Here’s what I did:

/lib/RT/User.pm (around line 128) <comment out ACL checks when creating a
User (allow anyone to create user)>

     #Check the ACL
     #unless ($self->CurrentUserHasRight('AdminUsers')) {
     #       return (0, 'No permission to create users');
     # }

Aieeee - you don’t want to do this (lots of repercussions if you change
ACL checks in User.pm). Instead, try changing:

my $user_obj = new RT::User($session{‘CurrentUser’});

to:

my $user_obj = new RT::User($RT::SystemUser);

Regards,

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B             Operations/Security