]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 276543: createaccount.cgi should not be displayed if account creation is disabled...
authorlpsolit%gmail.com <>
Wed, 30 Mar 2005 18:02:36 +0000 (18:02 +0000)
committerlpsolit%gmail.com <>
Wed, 30 Mar 2005 18:02:36 +0000 (18:02 +0000)
createaccount.cgi

index 6364e20bcb1d85c41362674099c16260e657227a..f6eb1f23c8a2544f117a3f070996b6f5a8bb27af 100755 (executable)
@@ -36,17 +36,20 @@ use vars qw(
   $vars
 );
 
+# Just in case someone already has an account, let them get the correct footer
+# on an error message.  The user is logged out just before the account is
+# actually created.
+Bugzilla->login();
+
 # If we're using LDAP for login, then we can't create a new account here.
 unless (Bugzilla::Auth->can_edit) {
-  # Just in case someone already has an account, let them get the correct
-  # footer on the error message
-  Bugzilla->login();
-  ThrowUserError("auth_cant_create_account");
+    ThrowUserError("auth_cant_create_account");
 }
 
-# Clear out the login cookies.  Make people log in again if they create an
-# account; otherwise, they'll probably get confused.
-Bugzilla->logout();
+my $createexp = Param('createemailregexp');
+unless ($createexp) {
+    ThrowUserError("account_creation_disabled");
+}
 
 my $cgi = Bugzilla->cgi;
 print $cgi->header();
@@ -66,13 +69,14 @@ if (defined($login)) {
         exit;
     }
 
-    my $createexp = Param('createemailregexp');
-    if (!($createexp)
-        || ($login !~ /$createexp/)) {
+    if ($login !~ /$createexp/) {
         ThrowUserError("account_creation_disabled");
         exit;
     }
     
+    # Clear out the login cookies in case the user is currently logged in.
+    Bugzilla->logout();
+    
     # Create account
     my $password = InsertNewUser($login, $realname);
     MailPassword($login, $password);