Commit d297f88d authored by bugreport%peshkin.net's avatar bugreport%peshkin.net

Bug 86029 create permission restrictions for createaccount.cgi (prevent people…

Bug 86029 create permission restrictions for createaccount.cgi (prevent people from creating accounts) r=burnus a=justdave
parent 2e6c635d
...@@ -69,6 +69,13 @@ if (defined($login)) { ...@@ -69,6 +69,13 @@ if (defined($login)) {
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
exit; exit;
} }
my $createexp = Param('createemailregexp');
if (!($createexp)
|| ($login !~ /$createexp/)) {
ThrowUserError("account_creation_disabled");
exit;
}
# Create account # Create account
my $password = InsertNewUser($login, $realname); my $password = InsertNewUser($login, $realname);
......
...@@ -694,6 +694,19 @@ You will get this message once a day until you\'ve dealt with these bugs! ...@@ -694,6 +694,19 @@ You will get this message once a day until you\'ve dealt with these bugs!
}, },
{ {
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', name => 'voteremovedmail',
desc => 'This is a mail message to send to anyone who gets a vote removed ' . desc => 'This is a mail message to send to anyone who gets a vote removed ' .
'from a bug for any reason. %to% gets replaced by the person who ' . 'from a bug for any reason. %to% gets replaced by the person who ' .
......
...@@ -102,10 +102,12 @@ ...@@ -102,10 +102,12 @@
[% UNLESS Param("useLDAP") %] [% UNLESS Param("useLDAP") %]
<hr> <hr>
<p> [% IF Param("createemailregexp") %]
If you don't have a Bugzilla account, you can <p>
<a href="createaccount.cgi">create a new account</a>. If you don't have a Bugzilla account, you can
</p> <a href="createaccount.cgi">create a new account</a>.
</p>
[% END %]
<form method="get" action="token.cgi"> <form method="get" action="token.cgi">
<input type="hidden" name="a" value="reqpw"> <input type="hidden" name="a" value="reqpw">
......
...@@ -121,7 +121,9 @@ ...@@ -121,7 +121,9 @@
[% ELSE %] [% ELSE %]
<td valign="middle" align="right"> <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> <a href="query.cgi?GoAheadAndLogIn=1">Log&nbsp;In</a>
</td> </td>
</tr> </tr>
......
...@@ -41,6 +41,12 @@ ...@@ -41,6 +41,12 @@
to any [% parameters %] which you may have set before calling to any [% parameters %] which you may have set before calling
ThrowUserError. 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" %] [% ELSIF error == "account_disabled" %]
[% title = "Account Disabled" %] [% title = "Account Disabled" %]
[% disabled_reason %] [% disabled_reason %]
......
...@@ -65,7 +65,9 @@ function addSidebar() { ...@@ -65,7 +65,9 @@ function addSidebar() {
<a href="relogin.cgi">Logout [% username FILTER html %]</a><br> <a href="relogin.cgi">Logout [% username FILTER html %]</a><br>
[% ELSE %] [% ELSE %]
<a href="query.cgi?GoAheadAndLogIn=1">Log in to an existing account</a><br> <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 %] [% END %]
</p><p> </p><p>
<a href="javascript:addSidebar()">Add to Sidebar</a> (Requires Mozilla or Netscape 6)<br> <a href="javascript:addSidebar()">Add to Sidebar</a> (Requires Mozilla or Netscape 6)<br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment