Class: Brightcontent::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Brightcontent::SessionsController
- Defined in:
- app/controllers/brightcontent/sessions_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/brightcontent/sessions_controller.rb', line 9 def create user = Brightcontent.user_model.find_by_email(params[:email]) if user && user.authenticate(params[:password]) session[:brightcontent_user_id] = user.id redirect_to root_url else flash.now[:danger] = "Email or password is invalid" render :new end end |
#destroy ⇒ Object
20 21 22 23 |
# File 'app/controllers/brightcontent/sessions_controller.rb', line 20 def destroy session[:brightcontent_user_id] = nil redirect_to root_url end |
#new ⇒ Object
5 6 7 |
# File 'app/controllers/brightcontent/sessions_controller.rb', line 5 def new redirect_to root_url if current_user end |