Class: Postnhost::SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Postnhost::SessionsController
- Defined in:
- app/controllers/postnhost/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/postnhost/sessions_controller.rb', line 8 def create user = Postnhost::User.find_by(email: session_params[:email].to_s.downcase.strip) if user&.authenticate(session_params[:password].to_s) sign_in(user) redirect_to articles_path else flash.now[:alert] = "Invalid email or password." render :new, status: :unprocessable_content end end |
#destroy ⇒ Object
20 21 22 23 |
# File 'app/controllers/postnhost/sessions_controller.rb', line 20 def destroy sign_out redirect_to root_path end |
#new ⇒ Object
6 |
# File 'app/controllers/postnhost/sessions_controller.rb', line 6 def new; end |