Class: PasswordResetsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PasswordResetsController
- Defined in:
- lib/rails/generators/simple_login/templates/controllers/password_resets_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
5 6 7 8 9 |
# File 'lib/rails/generators/simple_login/templates/controllers/password_resets_controller.rb', line 5 def create user = User.find_by_email(params[:email]) user.send_password_reset if user redirect_to root_url, :notice => "Email sent with password reset instructions." end |
#edit ⇒ Object
11 12 13 |
# File 'lib/rails/generators/simple_login/templates/controllers/password_resets_controller.rb', line 11 def edit @user = User.find_by_password_reset_token!(params[:id]) end |
#new ⇒ Object
2 3 |
# File 'lib/rails/generators/simple_login/templates/controllers/password_resets_controller.rb', line 2 def new end |
#update ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rails/generators/simple_login/templates/controllers/password_resets_controller.rb', line 15 def update @user = User.find_by_password_reset_token!(params[:id]) if @user.password_reset_sent_at < 2.hours.ago redirect_to new_password_reset_path, :alert => "Password reset has expired." elsif @user.update_attributes(params[:user]) redirect_to root_url, :notice => "Password has been reset!" else render :edit end end |