Sha256: 54c094009397345136fa2f75b8f3ac4764eaece9384b728328e08c16e309bb35
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
module OpenConferenceWare class AuthenticationsController < ApplicationController before_filter :require_auth_hash, only: [:create] # We need to accept a raw POST from an OmniAuth provider with no authenticity token. skip_before_filter :verify_authenticity_token, :only => :create def sign_in page_title "Sign In" end def sign_out cookies.delete :auth_token reset_session flash[:notice] = "You have been logged out." redirect_back_or_default end def create @authentication = Authentication.find_and_update_or_create_from_auth_hash(auth_hash) if @authentication.user self.current_user = @authentication.user elsif logged_in? @authentication.user = current_user @authentication.save else self.current_user = User.create_from_authentication(@authentication) end redirect_back_or_default end def failure flash[:error] = params[:message] redirect sign_in_path end protected def auth_hash request.env['omniauth.auth'] end def require_auth_hash redirect_to(sign_in_path) and return unless auth_hash end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
open_conference_ware-1.0.0.pre3 | app/controllers/open_conference_ware/authentications_controller.rb |