aboutsummaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2015-02-26 15:29:04 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2015-02-26 15:29:04 +0100
commita7b4b1ba18e33383e0f5723587ba40ddcdf82a91 (patch)
tree31cc0f26153cf54e13275229897d3dbac744db19 /extensions
parentd96dbf24caaffe018ef23912c7bb0c95b36ecd2a (diff)
downloadbugs-a7b4b1ba18e33383e0f5723587ba40ddcdf82a91.tar
bugs-a7b4b1ba18e33383e0f5723587ba40ddcdf82a91.tar.gz
bugs-a7b4b1ba18e33383e0f5723587ba40ddcdf82a91.tar.bz2
bugs-a7b4b1ba18e33383e0f5723587ba40ddcdf82a91.tar.xz
bugs-a7b4b1ba18e33383e0f5723587ba40ddcdf82a91.zip
Bug 1061271: Add a hook into Bugzilla::User::check_and_send_account_creation_confirmation()
r=gerv a=glob
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};