class Devbootcamp::Rails::AuthenticationController
Public Instance Methods
destroy()
click to toggle source
# File lib/devbootcamp/rails/authentication_controller.rb, line 28 def destroy unauthenticate! redirect_to devbootcamp_oauth_unauthorize_url end
new()
click to toggle source
# File lib/devbootcamp/rails/authentication_controller.rb, line 5 def new destination_url = params[:r] || root_url if authenticated? redirect_to destination_url else session[:post_authorization_destination_url] = destination_url redirect_to devbootcamp_oauth_authorize_url end end
oauth_callback()
click to toggle source
# File lib/devbootcamp/rails/authentication_controller.rb, line 15 def oauth_callback oauth_code = params[:code] if Devbootcamp::OAuth.authorize!(oauth_code) self.current_user = Devbootcamp::User.me session[:oauth_token] = Devbootcamp::OAuth.token_as_hash flash[:notice] = "Welcome back #{current_user.name}" else flash[:error] = 'Authorization Failed' end redirect_to session[:post_authorization_destination_url] || root_url end