2002-01-20 04:44:52 +03:00
|
|
|
#!/usr/bonsaitools/bin/perl -wT
|
1999-03-27 05:28:51 +03:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
1999-11-02 02:33:56 +03: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 05:28:51 +03:00
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
1999-11-02 02:33:56 +03:00
|
|
|
#
|
1999-03-27 05:28:51 +03:00
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-02 02:33:56 +03:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
1999-03-27 05:28:51 +03:00
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
|
|
|
# David Gardiner <david.gardiner@unisa.edu.au>
|
2000-09-15 22:35:18 +04:00
|
|
|
# Joe Robins <jmrobins@tgix.com>
|
2001-09-23 21:20:50 +04:00
|
|
|
# Christopher Aillon <christopher@aillon.com>
|
2002-01-30 02:26:37 +03:00
|
|
|
# Gervase Markham <gerv@gerv.net>
|
1999-03-27 05:28:51 +03:00
|
|
|
|
|
|
|
use diagnostics;
|
|
|
|
use strict;
|
|
|
|
|
2002-01-20 04:44:52 +03:00
|
|
|
use lib qw(.);
|
|
|
|
|
1999-03-27 05:28:51 +03:00
|
|
|
require "CGI.pl";
|
|
|
|
|
|
|
|
# Shut up misguided -w warnings about "used only once":
|
2002-02-13 05:27:24 +03:00
|
|
|
use vars qw(
|
|
|
|
%FORM
|
|
|
|
$template
|
|
|
|
$vars
|
|
|
|
);
|
1999-03-27 05:28:51 +03:00
|
|
|
|
2002-01-30 02:26:37 +03:00
|
|
|
ConnectToDatabase();
|
1999-03-27 05:28:51 +03:00
|
|
|
|
2000-09-15 22:35:18 +04:00
|
|
|
# If we're using LDAP for login, then we can't create a new account here.
|
|
|
|
if(Param('useLDAP')) {
|
2002-01-30 02:26:37 +03: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 22:35:18 +04:00
|
|
|
PutFooter();
|
|
|
|
exit;
|
|
|
|
}
|
1999-03-27 05:28:51 +03:00
|
|
|
|
2002-01-30 02:26:37 +03: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 05:28:51 +03:00
|
|
|
my $login = $::FORM{'login'};
|
2001-09-23 21:20:50 +04:00
|
|
|
my $realname = trim($::FORM{'realname'});
|
2002-01-30 02:26:37 +03:00
|
|
|
|
|
|
|
if (defined($login)) {
|
|
|
|
# We've been asked to create an account.
|
1999-03-27 05:28:51 +03:00
|
|
|
CheckEmailSyntax($login);
|
2002-04-17 06:55:10 +04:00
|
|
|
trick_taint($login);
|
2002-01-30 02:26:37 +03:00
|
|
|
$vars->{'login'} = $login;
|
|
|
|
|
2002-04-02 02:52:40 +04:00
|
|
|
if (!ValidateNewUser($login)) {
|
2002-01-30 02:26:37 +03:00
|
|
|
# Account already exists
|
2002-04-24 11:24:50 +04:00
|
|
|
$template->process("account/exists.html.tmpl", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|
2001-07-11 09:29:21 +04:00
|
|
|
exit;
|
1999-03-27 05:28:51 +03:00
|
|
|
}
|
2002-01-30 02:26:37 +03:00
|
|
|
|
|
|
|
# Create account
|
1999-08-19 04:06:01 +04:00
|
|
|
my $password = InsertNewUser($login, $realname);
|
1999-05-08 02:07:21 +04:00
|
|
|
MailPassword($login, $password);
|
2002-01-30 02:26:37 +03:00
|
|
|
|
2002-04-24 11:24:50 +04:00
|
|
|
$template->process("account/created.html.tmpl", $vars)
|
2002-04-24 11:28:11 +04:00
|
|
|
|| ThrowTemplateError($template->error());
|
1999-03-27 05:28:51 +03:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2002-01-30 02:26:37 +03:00
|
|
|
# Show the standard "would you like to create an account?" form.
|
2002-04-24 11:24:50 +04:00
|
|
|
$template->process("account/create.html.tmpl", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|