Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (14 sloc) 496 Bytes
class Admins::SessionsController < Devise::OmniauthCallbacksController
def callback
email = request.env['omniauth.auth'].info.to_hash['email'].downcase
if email =~ /@(the)?edgecase.com\Z/
@admin = Admin.find_or_create_by_email(email)
@admin.ensure_authentication_token!
sign_in @admin
flash.notice = "Authorized as #{email}"
else
flash.alert = "#{email} not authorized!"
end
redirect_to request.env['omniauth.origin'] || root_path
end
end
Jump to Line
Something went wrong with that request. Please try again.