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 @@
  • Sign in with Google
  • [% END %] - [% IF c.config.enable_persona %] -
  • Sign in with Persona
  • -
  • - [% END %]
  • Sign in with a Hydra account
  • diff --git a/src/script/hydra-create-user b/src/script/hydra-create-user index dc4a4381..bbfa6558 100755 --- a/src/script/hydra-create-user +++ b/src/script/hydra-create-user @@ -11,7 +11,7 @@ sub showHelp { print < \$renameFrom, die "$0: one user name required\n" if scalar @ARGV != 1; my $userName = $ARGV[0]; -die "$0: type must be `hydra' or `persona'\n" - if defined $type && $type ne "hydra" && $type ne "persona"; +die "$0: type must be `hydra' or `google'\n" + if defined $type && $type ne "hydra" && $type ne "google"; my $db = Hydra::Model::DB->new(); @@ -65,17 +65,17 @@ txn_do($db, sub { { username => $userName, type => "hydra", emailaddress => "", password => "!" }); } - die "$0: Persona user names must be email addresses\n" - if $user->type eq "persona" && $userName !~ /\@/; + die "$0: Google user names must be email addresses\n" + if $user->type eq "google" && $userName !~ /\@/; $user->update({ type => $type }) if defined $type; $user->update({ fullname => $fullName eq "" ? undef : $fullName }) if defined $fullName; - if ($user->type eq "persona") { - die "$0: Persona accounts do not have an explicitly set email address.\n" + if ($user->type eq "google") { + die "$0: Google accounts do not have an explicitly set email address.\n" if defined $emailAddress; - die "$0: Persona accounts do not have a password.\n" + die "$0: Google accounts do not have a password.\n" if defined $password; $user->update({ emailaddress => $userName, password => "!" }); } else { diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 2d996760..e1682759 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -10,7 +10,7 @@ create table Users ( emailAddress text not null, password text not null, -- sha256 hash emailOnError integer not null default 0, - type text not null default 'hydra', -- either "hydra" or "persona" + type text not null default 'hydra', -- either "hydra" or "google" publicDashboard boolean not null default false );