aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Example/Extension.pm22
1 files changed, 21 insertions, 1 deletions
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm
index af36b107a..dbc84df72 100644
--- a/extensions/Example/Extension.pm
+++ b/extensions/Example/Extension.pm
@@ -18,7 +18,7 @@ use Bugzilla::Error;
use Bugzilla::Group;
use Bugzilla::User;
use Bugzilla::User::Setting;
-use Bugzilla::Util qw(diff_arrays html_quote);
+use Bugzilla::Util qw(diff_arrays html_quote remote_ip);
use Bugzilla::Status qw(is_open_state);
use Bugzilla::Install::Filesystem;
use Bugzilla::WebService::Constants;
@@ -930,6 +930,26 @@ sub template_before_process {
}
}
+sub user_check_account_creation {
+ my ($self, $args) = @_;
+
+ my $login = $args->{login};
+ my $ip = remote_ip();
+
+ # Log all requests.
+ warn "USER ACCOUNT CREATION REQUEST FOR $login ($ip)";
+
+ # Reject requests based on their email address.
+ if ($login =~ /\@evil\.com$/) {
+ ThrowUserError('account_creation_restricted');
+ }
+
+ # Reject requests based on their IP address.
+ if ($ip =~ /^192\.168\./) {
+ ThrowUserError('account_creation_restricted');
+ }
+}
+
sub user_preferences {
my ($self, $args) = @_;
my $tab = $args->{current_tab};