Class: MerbAuthSlicePasswordReset::Passwords
- Inherits:
-
Application
- Object
- Merb::Controller
- Application
- MerbAuthSlicePasswordReset::Passwords
- Defined in:
- app/controllers/passwords.rb
Instance Method Summary collapse
Instance Method Details
#forgot_password ⇒ Object
3 4 5 6 |
# File 'app/controllers/passwords.rb', line 3 def forgot_password @login_param_name = Merb::Authentication::Strategies::Basic::Base.login_param render end |
#reset ⇒ Object
20 21 22 23 24 |
# File 'app/controllers/passwords.rb', line 20 def reset @user = Merb::Authentication.user_class.find_with_password_reset_code(params[:password_reset_code]) raise NotFound if @user.nil? render end |
#reset_check ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/passwords.rb', line 26 def reset_check @user = Merb::Authentication.user_class.find_with_password_reset_code(params[:password_reset_code]) # FIXME: This only works for DataMapper right now. I assume that the ActiveORM abstraction # will have a method that works for all ORMs. raise NotFound if @user.nil? if @user.update(params[:user]) redirect_after_password_reset else [:error] = @user.errors.map { |e| e.to_s }.join(" and ") if @user.errors render :reset end end |
#send_confirmation ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/passwords.rb', line 8 def send_confirmation @login_param_name = Merb::Authentication::Strategies::Basic::Base.login_param @user = Merb::Authentication.user_class.find_with_login_param(@login_param_name, params[@login_param_name]) if @user @user.send_password_reset_notification redirect_after_sending_confirmation else [:error] = "User with #{@login_param_name} \"%s\" not found".t(params[@login_param_name].freeze) render :forgot_password end end |