Commit 20408159 by tady

add access restriction

parent 4f8dc0df
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def google_oauth2
email = request.env['omniauth.auth'].info['email']
# reject if email is not zigexn nor ventura
if email !~ /@zigexn\.co\.jp$/ && email !~ /@zigexn\.vn$/
redirect_to root_path, flash: { alert: 'Your email address is not permitted.' }
return
end
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.find_for_google_oauth2(request.env['omniauth.auth'], current_user)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment