2002-01-20 01:44:52 +00:00
|
|
|
#!/usr/bonsaitools/bin/perl -wT
|
1999-03-27 02:28:51 +00:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
1999-11-01 23:33:56 +00:00
|
|
|
# The contents of this file are subject to the Mozilla Public
|
|
|
|
# License Version 1.1 (the "License"); you may not use this file
|
|
|
|
# except in compliance with the License. You may obtain a copy of
|
|
|
|
# the License at http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS
|
|
|
|
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
# implied. See the License for the specific language governing
|
|
|
|
# rights and limitations under the License.
|
|
|
|
#
|
1999-03-27 02:28:51 +00:00
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
1999-11-01 23:33:56 +00:00
|
|
|
#
|
1999-03-27 02:28:51 +00:00
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-01 23:33:56 +00:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
1999-03-27 02:28:51 +00:00
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
|
|
|
# David Gardiner <david.gardiner@unisa.edu.au>
|
2000-09-15 18:35:18 +00:00
|
|
|
# Joe Robins <jmrobins@tgix.com>
|
2001-09-23 17:20:50 +00:00
|
|
|
# Christopher Aillon <christopher@aillon.com>
|
2002-01-29 23:26:37 +00:00
|
|
|
# Gervase Markham <gerv@gerv.net>
|
1999-03-27 02:28:51 +00:00
|
|
|
|
|
|
|
use diagnostics;
|
|
|
|
use strict;
|
|
|
|
|
2002-01-20 01:44:52 +00:00
|
|
|
use lib qw(.);
|
|
|
|
|
1999-03-27 02:28:51 +00:00
|
|
|
require "CGI.pl";
|
|
|
|
|
|
|
|
# Shut up misguided -w warnings about "used only once":
|
2002-02-13 02:27:24 +00:00
|
|
|
use vars qw(
|
|
|
|
%FORM
|
|
|
|
$template
|
|
|
|
$vars
|
|
|
|
);
|
1999-03-27 02:28:51 +00:00
|
|
|
|
2002-01-29 23:26:37 +00:00
|
|
|
ConnectToDatabase();
|
1999-03-27 02:28:51 +00:00
|
|
|
|
2000-09-15 18:35:18 +00:00
|
|
|
# If we're using LDAP for login, then we can't create a new account here.
|
|
|
|
if(Param('useLDAP')) {
|
2002-01-29 23:26:37 +00:00
|
|
|
DisplayError("This site is using LDAP for authentication. Please contact
|
|
|
|
an LDAP administrator to get a new account created.",
|
|
|
|
"Can't create LDAP accounts");
|
2000-09-15 18:35:18 +00:00
|
|
|
PutFooter();
|
|
|
|
exit;
|
|
|
|
}
|
1999-03-27 02:28:51 +00:00
|
|
|
|
2002-01-29 23:26:37 +00:00
|
|
|
# Clear out the login cookies. Make people log in again if they create an
|
|
|
|
# account; otherwise, they'll probably get confused.
|
|
|
|
my $cookiepath = Param("cookiepath");
|
|
|
|
print "Set-Cookie: Bugzilla_login= ; path=$cookiepath; expires=Sun, 30-Jun-80 00:00:00 GMT
|
|
|
|
Set-Cookie: Bugzilla_logincookie= ; path=$cookiepath; expires=Sun, 30-Jun-80 00:00:00 GMT\n";
|
|
|
|
|
|
|
|
print "Content-Type: text/html\n\n";
|
|
|
|
|
1999-03-27 02:28:51 +00:00
|
|
|
my $login = $::FORM{'login'};
|
2001-09-23 17:20:50 +00:00
|
|
|
my $realname = trim($::FORM{'realname'});
|
2002-01-29 23:26:37 +00:00
|
|
|
|
|
|
|
if (defined($login)) {
|
|
|
|
# We've been asked to create an account.
|
1999-03-27 02:28:51 +00:00
|
|
|
CheckEmailSyntax($login);
|
2002-04-17 02:55:10 +00:00
|
|
|
trick_taint($login);
|
2002-01-29 23:26:37 +00:00
|
|
|
$vars->{'login'} = $login;
|
|
|
|
|
2002-04-01 22:52:40 +00:00
|
|
|
if (!ValidateNewUser($login)) {
|
2002-01-29 23:26:37 +00:00
|
|
|
# Account already exists
|
|
|
|
$template->process("admin/account_exists.tmpl", $vars)
|
|
|
|
|| DisplayError("Template process failed: " . $template->error());
|
2001-07-11 05:29:21 +00:00
|
|
|
exit;
|
1999-03-27 02:28:51 +00:00
|
|
|
}
|
2002-01-29 23:26:37 +00:00
|
|
|
|
|
|
|
# Create account
|
1999-08-19 00:06:01 +00:00
|
|
|
my $password = InsertNewUser($login, $realname);
|
1999-05-07 22:07:21 +00:00
|
|
|
MailPassword($login, $password);
|
2002-01-29 23:26:37 +00:00
|
|
|
|
|
|
|
$template->process("admin/account_created.tmpl", $vars)
|
|
|
|
|| DisplayError("Template process failed: " . $template->error());
|
1999-03-27 02:28:51 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2002-01-29 23:26:37 +00:00
|
|
|
# Show the standard "would you like to create an account?" form.
|
|
|
|
$template->process("admin/create_account.tmpl", $vars)
|
|
|
|
|| DisplayError("Template process failed: " . $template->error())
|
|
|
|
&& exit;
|