diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2015-02-26 15:27:30 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2015-02-26 15:27:30 +0100 |
commit | 0a8f7a59f894738d86564874fbabeb1c81f3178d (patch) | |
tree | 583fef7937bd9dfa2581566531a92f1555228ad6 /extensions/Example | |
parent | 0a0c32b2082a0f31757cc09af6d7f2ff9ba45168 (diff) | |
download | bugzilla-0a8f7a59f894738d86564874fbabeb1c81f3178d.tar.gz bugzilla-0a8f7a59f894738d86564874fbabeb1c81f3178d.tar.xz |
Bug 1061271: Add a hook into Bugzilla::User::check_and_send_account_creation_confirmation()
r=gerv a=glob
Diffstat (limited to 'extensions/Example')
-rw-r--r-- | extensions/Example/Extension.pm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index 0ab5220a7..a866e85e6 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; @@ -953,6 +953,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}; |