Class: PasswordsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PasswordsController
- Defined in:
- app/controllers/passwords_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/passwords_controller.rb', line 10 def create user = User.find_by_email!(params[:email]) user.reset_perishable_token! UserMailer.password_reset(user).deliver flash[:notice] = 'Email to reset password successfully sent.' redirect_to login_path rescue ActiveRecord::RecordNotFound flash.now[:alert] = 'Your email was not found. Did you mistype?' render :action => :new end |
#edit ⇒ Object
21 22 23 |
# File 'app/controllers/passwords_controller.rb', line 21 def edit # ... end |
#new ⇒ Object
6 7 8 |
# File 'app/controllers/passwords_controller.rb', line 6 def new # ... end |
#update ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/passwords_controller.rb', line 25 def update @user.update_attributes!(params[:user].merge(:perishable_token => nil)) login_as_user(@user) flash[:notice] = 'Your password was successfully updated!' redirect_to user_path(@user) rescue ActiveRecord::RecordInvalid flash[:notice] = 'An error occurred. Please try again.' redirect_to login_path end |