Fix omniauth GitHub scope to include user email access

This commit is contained in:
Eugene Burmakin 2025-10-26 15:32:26 +01:00
parent f5dc7a10a3
commit 44bbbd09b7
4 changed files with 6 additions and 7 deletions

View file

@ -152,7 +152,6 @@ class User < ApplicationRecord # rubocop:disable Metrics/ClassLength
return user if user
binding.pry
User.create(
email: data['email'],
password: Devise.friendly_token[0, 20]

View file

@ -62,10 +62,10 @@
<div class="form-control mt-6">
<%= f.submit "Update", class: 'btn btn-primary' %>
</div>
<%= render "devise/shared/links" %>
<% end %>
<%= render "devise/shared/links" %>
<p class='mt-3'>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: 'btn' %></p>
<div class="divider"></div>
<p class='mt-3 flex flex-col gap-2'>

View file

@ -63,10 +63,10 @@
<%= f.submit (@invitation ? "Create Account & Join Family" : "Sign up"),
class: 'btn btn-primary' %>
</div>
<% end %>
<% unless @invitation %>
<%= render "devise/shared/links" %>
<% end %>
<% unless @invitation %>
<%= render "devise/shared/links" %>
<% end %>
</div>
</div>

View file

@ -265,7 +265,7 @@ Devise.setup do |config|
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
config.omniauth :github, ENV['GITHUB_OAUTH_CLIENT_ID'], ENV['GITHUB_OAUTH_CLIENT_SECRET'], scope: 'user'
config.omniauth :github, ENV['GITHUB_OAUTH_CLIENT_ID'], ENV['GITHUB_OAUTH_CLIENT_SECRET'], scope: 'user:email'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or