Class: Clearance::SessionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/clearance/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/clearance/sessions_controller.rb', line 11

def create
  @user = ::User.authenticate(params[:session][:email],
                              params[:session][:password])
  if @user.nil?
    flash_failure_after_create
    render :template => 'sessions/new', :status => :unauthorized
  else
    if @user.email_confirmed?
      (@user)
      flash_success_after_create
      redirect_back_or(url_after_create)
    else
      ::ClearanceMailer.deliver_confirmation(@user)
      flash_notice_after_create
      redirect_to(new_session_url)
    end
  end
end

#destroyObject



30
31
32
33
34
# File 'app/controllers/clearance/sessions_controller.rb', line 30

def destroy
  sign_out
  flash_success_after_destroy
  redirect_to(url_after_destroy)
end

#newObject



7
8
9
# File 'app/controllers/clearance/sessions_controller.rb', line 7

def new
  render :template => 'sessions/new'
end