Skip to content

Commit

Permalink
Only verified should be able to use OAuth signin
Browse files Browse the repository at this point in the history
To help cercumvent spam, check users are verified before proceding to allow login to 3rd parties.
  • Loading branch information
MacTwister committed Nov 21, 2023
1 parent 621369f commit 039f69f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions config/initializers/doorkeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

# This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do
# raise "Please configure doorkeeper resource_owner_authenticator block located in #{__FILE__}"
# Put your resource owner authentication logic here.
# Example implementation:
User.find_by_id(session[:user_id]) || redirect_to(signin_url(goto: request.fullpath))
if current_user and current_user.verified?
current_user
else
redirect_to(signin_url(goto: request.fullpath))
end
end

# If you didn't skip applications controller from Doorkeeper routes in your application routes.rb
Expand Down

0 comments on commit 039f69f

Please sign in to comment.