my $sub = $userinfo->{sub};
my $openid = $userinfo->{openid_id};
+ my $email = $userinfo->{email};
# Do we have a user with the google id already?
}
my $new_user = $self->add_user({
- username => $sub,
- password => $user->password,
- role => $user->role,
- active => $user->active,
- sub => $sub,
+ username => $sub,
+ password => $user->password,
+ role => $user->role,
+ active => $user->active,
+ sub => $sub,
openid_id => $openid,
+ email => $email,
});
foreach my $t (@{ $user->traditions }) {
Catalyst::Exception->throw("id_token not specified.");
}
+ my $email = $authinfo->{email};
+ $email ||= $c->req->method eq 'GET' ? $c->req->query_params->{email} :
+ $c->req->body_params->{email};
+
my $userinfo = $self->decode($id_token);
my $sub = $userinfo->{sub};
my $openid = $userinfo->{openid_id};
+ $userinfo->{email} = $email if $email;
+
if (!$sub || !$openid) {
Catalyst::Exception->throw(
'Could not retrieve sub and openid from token! Is the token
$ua->get('/');
- $ua->content_contains('Hello! 4242!', 'We are logged in.');
+ $ua->content_contains('Hello! email@example.org!', 'We are logged in.');
ok $dir->find_user({ sub => 4242, openid_id => 'https://www.google.com/accounts/o8/id3' }), 'The G+ user is there.';
$ua->get('/');
- $ua->content_contains('Hello! 4242!', 'We are logged in.');
+ $ua->content_contains('Hello! email@example.org!', 'We ar logged in.');
}
io("$FindBin::Bin/var")->rmtree if io("$FindBin::Bin/var")->exists;