Class: Shoppe::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Shoppe::SessionsController
- Defined in:
- app/controllers/shoppe/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/shoppe/sessions_controller.rb', line 7 def create if user = Shoppe::User.authenticate(params[:email_address], params[:password]) session[:shoppe_user_id] = user.id redirect_to :orders else flash.now[:alert] = "The email address and/or password you have entered is invalid. Please check and try again." render :action => "new" end end |
#destroy ⇒ Object
17 18 19 20 |
# File 'app/controllers/shoppe/sessions_controller.rb', line 17 def destroy session[:shoppe_user_id] = nil redirect_to :login end |
#reset ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/shoppe/sessions_controller.rb', line 22 def reset if request.post? if user = Shoppe::User.find_by_email_address(params[:email_address]) user.reset_password! redirect_to login_path(:email_address => params[:email_address]), :notice => "An e-mail has been sent to #{user.email_address} with a new password" else flash.now[:alert] = "No user was found matching the e-mail address" end end end |