add custom form
Errietta Kostala [Mon, 19 Jan 2015 17:02:20 +0000 (17:02 +0000)]
lib/stemmaweb.pm
lib/stemmaweb/Authentication/Credential/Google.pm
lib/stemmaweb/Authentication/FormHandler.pm [new file with mode: 0644]

index 00c52cc..cc91f52 100644 (file)
@@ -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' => {
index 90308ae..ec8ec8a 100644 (file)
@@ -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 (file)
index 0000000..04557ae
--- /dev/null
@@ -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;