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 |
# 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 redirect_to login_path, :notice => 'Email to reset password successfully sent.' rescue ActiveRecord::RecordNotFound flash.now[:alert] = 'Your email was not found. Did you mistype?' render :action => :new end |
#edit ⇒ Object
20 21 22 |
# File 'app/controllers/passwords_controller.rb', line 20 def edit # ... end |
#new ⇒ Object
6 7 8 |
# File 'app/controllers/passwords_controller.rb', line 6 def new # ... end |
#update ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/controllers/passwords_controller.rb', line 24 def update @user.update_attributes!(params[:user].merge(:perishable_token => nil)) login_as_user(@user) redirect_to user_path(@user), :notice => 'Your password was successfully updated!' rescue ActiveRecord::RecordInvalid flash[:notice] = 'An error occurred. Please try again.' redirect_to login_path end |