sms-pager/app/controllers/oauths_controller.rb

33 lines
785 B
Ruby
Raw Normal View History

2015-10-07 22:03:31 -05:00
class OauthsController < ApplicationController
skip_before_filter :require_login
def oauth
login_at(params[:provider])
end
def callback
provider = params[:provider]
@user = login_from(provider)
if @user
redirect_to root_path, notice: "Logged in from #{provider.titleize}!"
else
2015-10-19 22:05:28 -05:00
msg = "Your account must be pre-approved. Please contact the administrator."
redirect_to root_path, notice: msg
2015-10-07 22:03:31 -05:00
end
end
private
2015-10-19 22:05:28 -05:00
# def create_and_login provider
# @user = create_from(provider)
# reset_session # protect from session fixation attack
# auto_login(@user)
# redirect_to root_path, notice: "Logged in from #{provider.titleize}!"
# end
2015-10-07 22:03:31 -05:00
def auth_params
params.permit(:code, :provider)
end
end