diff --git a/src/lib/Hydra/Controller/User.pm b/src/lib/Hydra/Controller/User.pm index c6bc3768..64296dd2 100644 --- a/src/lib/Hydra/Controller/User.pm +++ b/src/lib/Hydra/Controller/User.pm @@ -91,6 +91,7 @@ sub persona_login :Path('/persona-login') Args(0) { { username => $email , password => "!" , emailaddress => $email, + , type => "persona" }); $user = $c->find_user({ username => $email }) or die; } @@ -163,6 +164,7 @@ sub register :Local Args(0) { , fullname => $fullName , password => "!" , emailaddress => "", + , type => "hydra" }); setPassword($user, $password); }); @@ -245,7 +247,7 @@ sub edit_POST { } if (($c->stash->{params}->{submit} // "") eq "reset-password") { - error($c, "This user's password cannot be reset.") if $user->password eq "!"; + error($c, "This user's password cannot be reset.") if $user->type ne "hydra"; $c->stash->{json} = {}; error($c, "No email address is set for this user.") unless $user->emailaddress; @@ -274,7 +276,7 @@ sub edit_POST { }); my $password = $c->stash->{params}->{password} // ""; - if ($user->password ne "!" && $password ne "") { + if ($user->type eq "hydra" && $password ne "") { error($c, "You must specify a password of at least 6 characters.") unless isValidPassword($password); error($c, "The passwords you specified did not match.") diff --git a/src/lib/Hydra/Schema/Users.pm b/src/lib/Hydra/Schema/Users.pm index 245f44ee..a16370d3 100644 --- a/src/lib/Hydra/Schema/Users.pm +++ b/src/lib/Hydra/Schema/Users.pm @@ -61,6 +61,12 @@ __PACKAGE__->table("Users"); default_value: 0 is_nullable: 0 +=head2 type + + data_type: 'text' + default_value: 'hydra' + is_nullable: 0 + =cut __PACKAGE__->add_columns( @@ -74,6 +80,8 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 0 }, "emailonerror", { data_type => "integer", default_value => 0, is_nullable => 0 }, + "type", + { data_type => "text", default_value => "hydra", is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -176,8 +184,8 @@ Composing rels: L -> project __PACKAGE__->many_to_many("projects", "projectmembers", "project"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Hv9Ukqud0d3uIUot0ErKeg +# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-11-05 10:22:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Gd8KwFcnVShZ/WihvwfgQw my %hint = ( columns => [ diff --git a/src/root/layout.tt b/src/root/layout.tt index cc1f4ebf..70236b17 100644 --- a/src/root/layout.tt +++ b/src/root/layout.tt @@ -96,7 +96,7 @@ Hydra [% HTML.escape(version) %] (using [% HTML.escape(nixVersion) %]). [% IF c.user_exists %] - You are signed in as [% HTML.escape(c.user.username) %]. + You are signed in as [% HTML.escape(c.user.username) %][% IF c.user.type == 'persona' %] via Persona[% END %]. [% END %] @@ -113,7 +113,7 @@ } - [% IF c.user_exists && c.user.password != '!' %] + [% IF c.user_exists && c.user.type == 'hydra' %] diff --git a/src/root/topbar.tt b/src/root/topbar.tt index 097fd0c6..a5f7c3c1 100644 --- a/src/root/topbar.tt +++ b/src/root/topbar.tt @@ -128,7 +128,7 @@