summaryrefslogtreecommitdiffstats
path: root/extensions/GitHubAuth/Extension.pm
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/GitHubAuth/Extension.pm')
-rw-r--r--extensions/GitHubAuth/Extension.pm88
1 files changed, 46 insertions, 42 deletions
diff --git a/extensions/GitHubAuth/Extension.pm b/extensions/GitHubAuth/Extension.pm
index d0d9f42f1..85d81b02a 100644
--- a/extensions/GitHubAuth/Extension.pm
+++ b/extensions/GitHubAuth/Extension.pm
@@ -24,69 +24,73 @@ use URI::QueryParam;
our $VERSION = '0.01';
BEGIN {
- # Monkey-patch can() on Bugzilla::Auth::Login::CGI so that our own fail_nodata gets called.
- # Our fail_nodata behaves like CGI's, so this shouldn't be a problem for CGI-based logins.
+# Monkey-patch can() on Bugzilla::Auth::Login::CGI so that our own fail_nodata gets called.
+# Our fail_nodata behaves like CGI's, so this shouldn't be a problem for CGI-based logins.
- *Bugzilla::Auth::Login::CGI::can = sub {
- my ($stack, $method) = @_;
+ *Bugzilla::Auth::Login::CGI::can = sub {
+ my ($stack, $method) = @_;
- return undef if $method eq 'fail_nodata';
- return $stack->SUPER::can($method);
- };
+ return undef if $method eq 'fail_nodata';
+ return $stack->SUPER::can($method);
+ };
}
sub install_before_final_checks {
- Bugzilla::Group->create({
- name => 'no-github-auth',
- description => 'Group containing groups whose members may not use GitHubAuth to log in',
- isbuggroup => 0,
- }) unless Bugzilla::Group->new({ name => 'no-github-auth' });
+ Bugzilla::Group->create({
+ name => 'no-github-auth',
+ description =>
+ 'Group containing groups whose members may not use GitHubAuth to log in',
+ isbuggroup => 0,
+ })
+ unless Bugzilla::Group->new({name => 'no-github-auth'});
}
sub attachment_should_redirect_login {
- my ($self, $args) = @_;
- my $cgi = Bugzilla->cgi;
+ my ($self, $args) = @_;
+ my $cgi = Bugzilla->cgi;
- if ($cgi->param('github_state') || $cgi->param('github_email')) {
- ${$args->{do_redirect}} = 1;
- }
+ if ($cgi->param('github_state') || $cgi->param('github_email')) {
+ ${$args->{do_redirect}} = 1;
+ }
}
sub auth_login_methods {
- my ($self, $args) = @_;
- my $modules = $args->{'modules'};
- if (exists $modules->{'GitHubAuth'}) {
- $modules->{'GitHubAuth'} = 'Bugzilla/Extension/GitHubAuth/Login.pm';
- }
+ my ($self, $args) = @_;
+ my $modules = $args->{'modules'};
+ if (exists $modules->{'GitHubAuth'}) {
+ $modules->{'GitHubAuth'} = 'Bugzilla/Extension/GitHubAuth/Login.pm';
+ }
}
sub auth_verify_methods {
- my ($self, $args) = @_;
- my $modules = $args->{'modules'};
- if (exists $modules->{'GitHubAuth'}) {
- $modules->{'GitHubAuth'} = 'Bugzilla/Extension/GitHubAuth/Verify.pm';
- }
+ my ($self, $args) = @_;
+ my $modules = $args->{'modules'};
+ if (exists $modules->{'GitHubAuth'}) {
+ $modules->{'GitHubAuth'} = 'Bugzilla/Extension/GitHubAuth/Verify.pm';
+ }
}
sub config_modify_panels {
- my ($self, $args) = @_;
- my $auth_panel_params = $args->{panels}{auth}{params};
-
- my $user_info_class = first { $_->{name} eq 'user_info_class' } @$auth_panel_params;
- if ($user_info_class) {
- push @{ $user_info_class->{choices} }, "GitHubAuth,CGI";
- }
-
- my $user_verify_class = first { $_->{name} eq 'user_verify_class' } @$auth_panel_params;
- if ($user_verify_class) {
- unshift @{ $user_verify_class->{choices} }, "GitHubAuth";
- }
+ my ($self, $args) = @_;
+ my $auth_panel_params = $args->{panels}{auth}{params};
+
+ my $user_info_class
+ = first { $_->{name} eq 'user_info_class' } @$auth_panel_params;
+ if ($user_info_class) {
+ push @{$user_info_class->{choices}}, "GitHubAuth,CGI";
+ }
+
+ my $user_verify_class
+ = first { $_->{name} eq 'user_verify_class' } @$auth_panel_params;
+ if ($user_verify_class) {
+ unshift @{$user_verify_class->{choices}}, "GitHubAuth";
+ }
}
sub config_add_panels {
- my ($self, $args) = @_;
- my $modules = $args->{panel_modules};
- $modules->{GitHubAuth} = "Bugzilla::Extension::GitHubAuth::Config";
+ my ($self, $args) = @_;
+ my $modules = $args->{panel_modules};
+ $modules->{GitHubAuth} = "Bugzilla::Extension::GitHubAuth::Config";
}
__PACKAGE__->NAME;