Sha256: 8fb70ffa1ea697ac0320facc1962a3025aff7a4d1b7bbb925ddd05bf5b0c3c7d
Contents?: true
Size: 825 Bytes
Versions: 1
Compression:
Stored size: 825 Bytes
Contents
module Socialite class SessionController < ApplicationController unloadable before_filter :ensure_user, :only => [:destroy] before_filter :ensure_no_user, :except => [:destroy] respond_to :html, :json def new; end def create @identity = Identity.find_or_initialize_by_oauth(env['omniauth.auth']) @identity.build_user if @identity.user.blank? if @identity.save self.current_user = @identity.user flash_message :notice, 'You have logged in successfully.' else flash_message :error, 'An error occurred. Please try again.' end respond_with(identity) do |format| format.html { redirect_back_or_default } end end def destroy logout! redirect_to main_app.root_path, notice: 'Signed out!' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
socialite-0.1.0.pre | app/controllers/socialite/session_controller.rb |