From: Errietta Kostala Date: Mon, 19 Jan 2015 17:02:20 +0000 (+0000) Subject: add custom form X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b1d9ab02c0b3c923596ebae9d3e2e4c45397c8f7;p=scpubgit%2Fstemmaweb.git add custom form --- diff --git a/lib/stemmaweb.pm b/lib/stemmaweb.pm index 00c52cc..cc91f52 100644 --- a/lib/stemmaweb.pm +++ b/lib/stemmaweb.pm @@ -61,6 +61,7 @@ __PACKAGE__->config( }, ## kiokudb auth store testing 'Plugin::Authentication' => { + form_handler => '+stemmaweb::Authentication::FormHandler', default => { credential => { class => 'Password', @@ -118,6 +119,7 @@ __PACKAGE__->config( realm => 'default', login_fields => { openid => [qw/openid_identifier/], default => [qw/username password remember/], + google => [qw/email id_token/], }, }, 'View::Email::Template' => { diff --git a/lib/stemmaweb/Authentication/Credential/Google.pm b/lib/stemmaweb/Authentication/Credential/Google.pm index 90308ae..ec8ec8a 100644 --- a/lib/stemmaweb/Authentication/Credential/Google.pm +++ b/lib/stemmaweb/Authentication/Credential/Google.pm @@ -28,6 +28,8 @@ sub new { my ($class, $config, $app, $realm) = @_; $class = ref $class || $class; + warn "MEEP\n\n"; + my $self = { _config => $config, _app => $app, @@ -92,6 +94,7 @@ sub authenticate { username => $sub, password => $user->password, role => $user->role, + active => $user->active, }); foreach my $t (@{ $user->traditions }) { @@ -108,6 +111,7 @@ sub authenticate { $realm->delete_user({ username => $user->id }); + return $new_user; } diff --git a/lib/stemmaweb/Authentication/FormHandler.pm b/lib/stemmaweb/Authentication/FormHandler.pm new file mode 100644 index 0000000..04557ae --- /dev/null +++ b/lib/stemmaweb/Authentication/FormHandler.pm @@ -0,0 +1,19 @@ +package stemmaweb::Authentication::FormHandler; + +use HTML::FormHandler::Moose; +use namespace::autoclean; + +extends 'HTML::FormHandlerX::Form::Login'; + +has_field email => ( + type => 'Text', + required => 0, +); + +has_field id_token => ( + type => 'Text', + required => 0, +); + + +1;