Class: Muck::UserSessionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/muck/user_sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/muck/user_sessions_controller.rb', line 24

def create
  @title = t('muck.users.sign_in_title')    
  @user_session = UserSession.new(params[:user_session])
  if success = before_create_user_session
    @user_session.save do |result|
      success = result
    end
  end
  success = after_create_user_session(success)
  after_create_response(success)
end

#destroyObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/muck/user_sessions_controller.rb', line 36

def destroy
  @title = t('muck.users.sign_out_title')
  before_destroy_user_session
  current_user.reset_single_access_token! if params[:reset_api_key]
  current_user_session.destroy
  flash[:notice] = t('muck.users.login_out_success')
  after_destroy_user_session
  respond_to do |format|
    format.html { redirect_to logout_complete_path }
    format.json { render :json => { :logged_in => false, :message => t('muck.users.login_out_success') } }
  end
end

#login_checkObject



49
50
51
# File 'app/controllers/muck/user_sessions_controller.rb', line 49

def 
  render :json => { :logged_in => logged_in? }
end

#newObject



16
17
18
19
20
21
22
# File 'app/controllers/muck/user_sessions_controller.rb', line 16

def new
  @title = t('muck.users.sign_in_title')
  @user_session = UserSession.new
  respond_to do |format|
    format.html { render :template => 'user_sessions/new' }
  end
end

#showObject



7
8
9
10
11
12
13
14
# File 'app/controllers/muck/user_sessions_controller.rb', line 7

def show
  if logged_in?
    redirect_to current_user
  else
    flash[:notice] = t('muck.users.login_fail')
    redirect_to 
  end
end