]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 86029 create permission restrictions for createaccount.cgi (prevent people from...
authorbugreport%peshkin.net <>
Mon, 9 Dec 2002 08:24:34 +0000 (08:24 +0000)
committerbugreport%peshkin.net <>
Mon, 9 Dec 2002 08:24:34 +0000 (08:24 +0000)
r=burnus
a=justdave

createaccount.cgi
defparams.pl
template/en/default/account/login.html.tmpl
template/en/default/global/useful-links.html.tmpl
template/en/default/global/user-error.html.tmpl
template/en/default/index.html.tmpl

index 37776a7800da45315dda92f2016db33e76089dc0..4ce347fcf5a28ca6f8cfb3cc21536bcd3e04103d 100755 (executable)
@@ -69,6 +69,13 @@ if (defined($login)) {
           || ThrowTemplateError($template->error());
         exit;
     }
+
+    my $createexp = Param('createemailregexp');
+    if (!($createexp)
+        || ($login !~ /$createexp/)) {
+        ThrowUserError("account_creation_disabled");
+        exit;
+    }
     
     # Create account
     my $password = InsertNewUser($login, $realname);
index 3e4807dc242ba820a563d721f0ebc58f60d7d4ec..fc3fe82453c2def46172b84fbd2c8e2328c6c811 100644 (file)
@@ -693,6 +693,19 @@ You will get this message once a day until you\'ve dealt with these bugs!
    default => ''
   },
 
+  {
+   name => 'createemailregexp',
+   desc => 'This defines the regexp to use for email addresses that are ' .
+           'permitted to self-register using a "New Account" feature. The ' .
+           'default (.*) permits any account matching the emailregexp ' .
+           'to be created.  If this parameter is left blank, no users ' .
+           'will be permitted to create their own accounts and all accounts ' .
+           'will have to be created by an administrator',
+   type => 't',
+   default => q:.*:,
+   checker => \&check_regexp
+  },
+
   {
    name => 'voteremovedmail',
    desc => 'This is a mail message to send to anyone who gets a vote removed ' .
index 16a49580f4f2455ebcf33a71570e7ec057738397..7d6e298d2b079b2cc978c0e41db570aef98cbad0 100644 (file)
 [% UNLESS Param("useLDAP") %]
   <hr>
 
-  <p>
-    If you don't have a Bugzilla account, you can 
-    <a href="createaccount.cgi">create a new account</a>.
-  </p>
+  [% IF Param("createemailregexp") %]
+    <p>
+      If you don't have a Bugzilla account, you can 
+      <a href="createaccount.cgi">create a new account</a>.
+    </p>
+  [% END %]
 
   <form method="get" action="token.cgi">
     <input type="hidden" name="a" value="reqpw">
index e172a0f5578d700fa2dfac4f171960f97f8ab15b..fac714b0e97da09225a37f66215c578f5487c857 100644 (file)
       
     [% ELSE %]    
       <td valign="middle" align="right">
-        <a href="createaccount.cgi">New&nbsp;Account</a> | 
+        [% IF Param('createemailregexp') %]
+          <a href="createaccount.cgi">New&nbsp;Account</a> | 
+        [% END %]
         <a href="query.cgi?GoAheadAndLogIn=1">Log&nbsp;In</a>
       </td>
     </tr>
index 0d43b62a5eb89fdbcd559e1460791f1766441244..965a3fb27e42071541a9eb0597ceb39017f4e027 100644 (file)
     to any [% parameters %] which you may have set before calling
     ThrowUserError.
 
+  [% ELSIF error == "account_creation_disabled" %]
+    [% title = "Account Creation Disabled" %]
+    Account self-creation has been disabled or restricted.
+    <hr>
+    New accounts must be created by an administrator.
+
   [% ELSIF error == "account_disabled" %]
     [% title = "Account Disabled" %]
     [% disabled_reason %]
index 07cdf63b538d435ec1cc43c854030466b0e5e351..dccf43f58398f1aa0cbf5c364e03593a7ec6bc9d 100644 (file)
@@ -65,7 +65,9 @@ function addSidebar() {
   <a href="relogin.cgi">Logout [% username FILTER html %]</a><br>
 [% ELSE %]
   <a href="query.cgi?GoAheadAndLogIn=1">Log in to an existing account</a><br>
-  <a href="createaccount.cgi">Open a new Bugzilla account</a><br>
+  [% IF Param('createemailregexp') %]
+    <a href="createaccount.cgi">Open a new Bugzilla account</a><br>
+  [% END %]
 [% END %]
   </p><p>
   <a href="javascript:addSidebar()">Add to Sidebar</a> (Requires Mozilla or Netscape 6)<br>