Class: SessionsController
Instance Method Summary
collapse
current
Methods included from PathHelper
#finance_group_transactions_path
Instance Method Details
#create ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/sessions_controller.rb', line 11
def create
user = User.authenticate(params[:nick], params[:password])
if user
user.update_attribute(:last_login, Time.now)
login_and_redirect_to_return_to 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
|
#destroy ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'app/controllers/sessions_controller.rb', line 22
def destroy
logout
if FoodsoftConfig[:logout_redirect_url].present?
redirect_to FoodsoftConfig[:logout_redirect_url], allow_other_host: true
else
redirect_to login_url, notice: I18n.t('sessions.logged_out')
end
end
|
#new ⇒ Object
5
6
7
8
9
|
# File 'app/controllers/sessions_controller.rb', line 5
def new
respond_to do |format|
format.html
end
end
|
#redirect_to_foodcoop ⇒ Object
redirect to root, going to default foodcoop when none given this may not be so much session-related, but it must be somewhere
33
34
35
|
# File 'app/controllers/sessions_controller.rb', line 33
def redirect_to_foodcoop
redirect_to root_path
end
|