Class: Admin::PasswordResetsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PasswordResetsController
- Defined in:
- app/controllers/admin/password_resets_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/admin/password_resets_controller.rb', line 5 def create user = User.find_by_email(params[:email]) if user user.send_password_reset redirect_to welcome_path, :notice => "Email sent with password reset instructions." else redirect_to welcome_path, :notice => "Email not registered. Double check your spelling or seek out your Admin." end end |
#edit ⇒ Object
15 16 17 |
# File 'app/controllers/admin/password_resets_controller.rb', line 15 def edit @user = User.find_by_password_reset_token!(params[:id]) end |
#update ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/admin/password_resets_controller.rb', line 19 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(password_params) redirect_to welcome_url, :notice => "Password has been reset!" else render :edit end end |