Class: Aspartame::AspartameSessionsController

Inherits:
ApplicationController show all
Includes:
AspartameSessionsHelper
Defined in:
app/controllers/aspartame/aspartame_sessions_controller.rb

Instance Method Summary collapse

Methods included from AspartameSessionsHelper

#aspartame_current_user, #aspartame_current_user=, #aspartame_current_user?, #aspartame_redirect_back_or, #aspartame_sign_in, #aspartame_sign_out, #aspartame_signed_in?, #aspartame_signed_in_user, #aspartame_store_location

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/aspartame/aspartame_sessions_controller.rb', line 8

def create
  aspartame_user = Aspartame::AspartameUser.find_by_email(params[:session][:email])
  if aspartame_user && aspartame_user.authenticate(params[:session][:password])
     aspartame_user
    # aspartame_redirect_back_or aspartame_user
    redirect_to aspartame.root_path
  else
    flash.now[:error] = 'Invalid email/password combination'
    render 'new'
  end
end

#destroyObject



20
21
22
23
# File 'app/controllers/aspartame/aspartame_sessions_controller.rb', line 20

def destroy
  aspartame_sign_out
  redirect_to 
end