diff options
author | Dave Arter <davea@mysociety.org> | 2019-06-19 15:17:49 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-08-16 12:01:13 +0100 |
commit | 8d9429a690dc6814ca3f356eb2c67cfa045dfbec (patch) | |
tree | 42b1cd83d8eab48ecfb7d89a481d5b39d96ffadd | |
parent | eb03257ccc8510f5bab9f8786b8bd6cebedda86a (diff) |
Set user’s name when creating user via OAuth
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Auth.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Auth/Social.pm | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Auth.pm b/perllib/FixMyStreet/App/Controller/Auth.pm index c194045b9..50d11a10c 100644 --- a/perllib/FixMyStreet/App/Controller/Auth.pm +++ b/perllib/FixMyStreet/App/Controller/Auth.pm @@ -180,6 +180,9 @@ sub email_sign_in : Private { name => $c->get_param('name'), password => $user->password, }; + $token_data->{name} = $c->session->{oauth}{name} + if $c->get_param('oauth_need_email') && $c->session->{oauth}{name} && !$token_data->{name}; + $token_data->{facebook_id} = $c->session->{oauth}{facebook_id} if $c->get_param('oauth_need_email') && $c->session->{oauth}{facebook_id}; $token_data->{twitter_id} = $c->session->{oauth}{twitter_id} diff --git a/perllib/FixMyStreet/App/Controller/Auth/Social.pm b/perllib/FixMyStreet/App/Controller/Auth/Social.pm index 097cac984..d1a2c37cb 100644 --- a/perllib/FixMyStreet/App/Controller/Auth/Social.pm +++ b/perllib/FixMyStreet/App/Controller/Auth/Social.pm @@ -179,6 +179,7 @@ sub oauth_success : Private { } else { # No matching ID, store ID for use later $c->session->{oauth}{$type . '_id'} = $uid; + $c->session->{oauth}{name} = $name; $c->stash->{oauth_need_email} = 1; } } |