~ubuntu-branches/ubuntu/edgy/bugzilla/edgy

« back to all changes in this revision

Viewing changes to createaccount.cgi

  • Committer: Bazaar Package Importer
  • Author(s): Alexis Sukrieh
  • Date: 2006-06-07 12:49:53 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060607124953-ymjflzzsex0u1fzj
Tags: 2.22-1
* New upstream release (2.22).
  (closes: #365304)
* Tempaltes moved to `/var/lib/bugzilla' instead of `/usr/share/bugzilla'
  which is more appropriate, and compliant with README.Debian.
  (closes: #368605)
* Doesn't overwrite `/etc/bugzilla/localconfig' silently, uses ucf for
  replacing this file so the local administrator can check if he wants to
  update the DB access or not. It's then possible to upgrade from version
  prior to 2.22 with denying to use dbconfig-common.
  (closes: #366961)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
use lib qw(.);
30
30
 
31
 
require "CGI.pl";
 
31
require "globals.pl";
32
32
 
33
33
use Bugzilla;
34
34
use Bugzilla::Constants;
35
35
use Bugzilla::User;
36
 
 
37
 
# Shut up misguided -w warnings about "used only once":
38
 
use vars qw($template $vars);
 
36
use Bugzilla::BugMail;
 
37
use Bugzilla::Util;
39
38
 
40
39
# Just in case someone already has an account, let them get the correct footer
41
40
# on an error message. The user is logged out just after the account is
44
43
 
45
44
my $dbh = Bugzilla->dbh;
46
45
my $cgi = Bugzilla->cgi;
 
46
my $template = Bugzilla->template;
 
47
my $vars = {};
 
48
 
47
49
print $cgi->header();
48
50
 
49
51
# If we're using LDAP for login, then we can't create a new account here.
61
63
if (defined($login)) {
62
64
    # We've been asked to create an account.
63
65
    my $realname = trim($cgi->param('realname'));
64
 
    CheckEmailSyntax($login);
 
66
 
 
67
    validate_email_syntax($login)
 
68
      || ThrowUserError('illegal_email_address', {addr => $login});
 
69
 
65
70
    $vars->{'login'} = $login;
66
71
 
67
 
    $dbh->bz_lock_tables('profiles WRITE', 'email_setting WRITE', 'tokens READ');
 
72
    $dbh->bz_lock_tables('profiles WRITE', 'groups READ',
 
73
                         'user_group_map WRITE', 'email_setting WRITE',
 
74
                         'tokens READ');
68
75
 
69
76
    if (!is_available_username($login)) {
70
77
        # Account already exists
86
93
    # Clear out the login cookies in case the user is currently logged in.
87
94
    Bugzilla->logout();
88
95
 
89
 
    MailPassword($login, $password);
 
96
    Bugzilla::BugMail::MailPassword($login, $password);
90
97
    
91
98
    $template->process("account/created.html.tmpl", $vars)
92
99
      || ThrowTemplateError($template->error());