Class: SessionsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

current

Methods included from PathHelper

#finance_group_transactions_path

Instance Method Details

#createObject


12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/sessions_controller.rb', line 12

def create
  user = User.authenticate(params[:nick], params[:password])
  if user
    user.update_attribute(:last_login, Time.now)
     user, :notice => I18n.t('sessions.logged_in')
  else
    flash.now.alert = I18n.t(FoodsoftConfig[:use_nick] ? 'sessions.login_invalid_nick' : 'sessions.login_invalid_email')
    render "new"
  end
end

#destroyObject


23
24
25
26
# File 'app/controllers/sessions_controller.rb', line 23

def destroy
  logout
  redirect_to , :notice => I18n.t('sessions.logged_out')
end

#newObject


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

def new
  respond_to do |format|
    format.html
  end
end

#redirect_to_foodcoopObject

redirect to root, going to default foodcoop when none given this may not be so much session-related, but it must be somewhere


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

def redirect_to_foodcoop
  redirect_to root_path
end