diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2012-01-09 21:56:14 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2012-01-09 21:56:14 +0100 |
commit | 0c449e2d96804f6e48d3812b42ccf407fbbeb747 (patch) | |
tree | dfdd8c56789ff02c925b5b55e11faf890f1ecd98 /createaccount.cgi | |
parent | ddf1fb2abb2a6266ce5a9cc525c84563c154df52 (diff) | |
parent | a7785661b8e7dcb7a6914eebf1a11fd99f1cf037 (diff) | |
download | bugzilla-0c449e2d96804f6e48d3812b42ccf407fbbeb747.tar.gz bugzilla-0c449e2d96804f6e48d3812b42ccf407fbbeb747.tar.xz |
merge with bugzilla/4.2
Diffstat (limited to 'createaccount.cgi')
-rwxr-xr-x | createaccount.cgi | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/createaccount.cgi b/createaccount.cgi index 2348d4e91..acc63e891 100755 --- a/createaccount.cgi +++ b/createaccount.cgi @@ -31,34 +31,19 @@ use lib qw(. lib); use Bugzilla; use Bugzilla::Constants; use Bugzilla::Error; -use Bugzilla::User; -use Bugzilla::BugMail; -use Bugzilla::Util; +use Bugzilla::Token; # Just in case someone already has an account, let them get the correct footer # on an error message. The user is logged out just after the account is # actually created. -Bugzilla->login(LOGIN_OPTIONAL); - -my $dbh = Bugzilla->dbh; +my $user = Bugzilla->login(LOGIN_OPTIONAL); my $cgi = Bugzilla->cgi; my $template = Bugzilla->template; -my $vars = {}; - -$vars->{'doc_section'} = 'myaccount.html'; +my $vars = { doc_section => 'myaccount.html' }; print $cgi->header(); -# If we're using LDAP for login, then we can't create a new account here. -unless (Bugzilla->user->authorizer->user_can_create_account) { - ThrowUserError("auth_cant_create_account"); -} - -my $createexp = Bugzilla->params->{'createemailregexp'}; -unless ($createexp) { - ThrowUserError("account_creation_disabled"); -} - +$user->check_account_creation_enabled; my $login = $cgi->param('login'); if (defined($login)) { @@ -67,16 +52,9 @@ if (defined($login)) { my $token = $cgi->param('token'); check_hash_token($token, ['create_account']); - $login = Bugzilla::User->check_login_name_for_creation($login); + $user->check_and_send_account_creation_confirmation($login); $vars->{'login'} = $login; - if ($login !~ /$createexp/i) { - ThrowUserError("account_creation_restricted"); - } - - # Create and send a token for this new account. - Bugzilla::Token::issue_new_user_account_token($login); - $template->process("account/created.html.tmpl", $vars) || ThrowTemplateError($template->error()); exit; |