Class: Kwipper::SessionsController
- Inherits:
-
Controller
- Object
- Controller
- Kwipper::SessionsController
- Defined in:
- app/controllers/sessions_controller.rb
Constant Summary
Constants inherited from Controller
Constants included from RendersViews
RendersViews::VIEWS_PATH, RendersViews::VIEW_EXT
Instance Attribute Summary
Attributes inherited from Controller
#action, #app, #request, #response
Instance Method Summary collapse
Methods inherited from Controller
add_routes, #home, #initialize, #process
Methods included from RendersViews
Constructor Details
This class inherits a constructor from Kwipper::Controller
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/sessions_controller.rb', line 8 def create @user = User.authenticate params['username'], params['password'] if @user Session.create({ 'id' => response., 'user_id' => @user.id, 'created_at' => Time.now.httpdate }) redirect '/users' else redirect '/users/login', :bad_request end end |
#destroy ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/sessions_controller.rb', line 24 def destroy if current_session current_session.destroy response. end redirect '/' end |