diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 8aa26864..1d03bb38 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -18,8 +18,7 @@ __PACKAGE__->config->{namespace} = ''; sub noLoginNeeded { my ($c) = @_; - return $c->request->path eq "persona-login" || - $c->request->path eq "google-login" || + return $c->request->path eq "google-login" || $c->request->path eq "login" || $c->request->path eq "logo" || $c->request->path =~ /^static\//; diff --git a/src/lib/Hydra/Controller/User.pm b/src/lib/Hydra/Controller/User.pm index 4f28be28..e9953a83 100644 --- a/src/lib/Hydra/Controller/User.pm +++ b/src/lib/Hydra/Controller/User.pm @@ -54,10 +54,10 @@ sub doEmailLogin { # in URLs. die "Illegal email address.\n" unless $email =~ /^[a-zA-Z0-9\.\-\_]+@[a-zA-Z0-9\.\-\_]+$/; - # If persona_allowed_domains is set, check if the email address + # If allowed_domains is set, check if the email address # returned is on these domains. When not configured, allow all # domains. - my $allowed_domains = $c->config->{persona_allowed_domains} || ""; + my $allowed_domains = $c->config->{allowed_domains} // ($c->config->{persona_allowed_domains} // ""); if ($allowed_domains ne "") { my $email_ok = 0; my @domains = split ',', $allowed_domains; @@ -73,7 +73,7 @@ sub doEmailLogin { my $user = $c->find_user({ username => $email }); if ($user) { - # Automatically upgrade Persona accounts to Google accounts. + # Automatically upgrade legacy Persona accounts to Google accounts. if ($user->type eq "persona" && $type eq "google") { $user->update({type => "google"}); } @@ -97,29 +97,6 @@ sub doEmailLogin { } -sub persona_login :Path('/persona-login') Args(0) { - my ($self, $c) = @_; - requirePost($c); - - error($c, "Logging in via Persona is not enabled.") unless $c->config->{enable_persona}; - - my $assertion = $c->stash->{params}->{assertion} or die; - - my $ua = new LWP::UserAgent; - my $response = $ua->post( - 'https://verifier.login.persona.org/verify', - { assertion => $assertion, - audience => $c->uri_for('/') - }); - error($c, "Did not get a response from Persona.") unless $response->is_success; - - my $d = decode_json($response->decoded_content) or die; - error($c, "Persona says: $d->{reason}") if $d->{status} ne "okay"; - - doEmailLogin($self, $c, "persona", $d->{email}, undef); -} - - sub google_login :Path('/google-login') Args(0) { my ($self, $c) = @_; requirePost($c); diff --git a/src/root/auth.tt b/src/root/auth.tt index 4374daba..b2466019 100644 --- a/src/root/auth.tt +++ b/src/root/auth.tt @@ -4,10 +4,6 @@ [% END %] - [% IF c.user.type == 'persona' %] - - [% END %] - @@ -104,25 +97,4 @@ [% END %] - [% IF c.config.enable_persona %] - - [% END %] - [% END %] diff --git a/src/root/layout.tt b/src/root/layout.tt index d16043de..3126252f 100644 --- a/src/root/layout.tt +++ b/src/root/layout.tt @@ -104,8 +104,7 @@ Hydra [% HTML.escape(version) %] (using [% HTML.escape(nixVersion) %]). [% IF c.user_exists %] You are signed in as [% HTML.escape(c.user.username) %] - [%- IF c.user.type == 'persona' %] via Persona - [%- ELSIF c.user.type == 'google' %] via Google[% END %]. + [%- IF c.user.type == 'google' %] via Google[% END %]. [% END %] diff --git a/src/root/topbar.tt b/src/root/topbar.tt index 0503d15c..ee093f88 100644 --- a/src/root/topbar.tt +++ b/src/root/topbar.tt @@ -136,10 +136,6 @@