Class: ForgotPasswordPortlet
- Inherits:
-
Cms::Portlet
- Object
- ActiveRecord::Base
- Cms::Portlet
- ForgotPasswordPortlet
- Defined in:
- app/portlets/forgot_password_portlet.rb
Instance Attribute Summary
Attributes inherited from Cms::Portlet
#connect_to_container, #connect_to_page_id, #controller
Instance Method Summary collapse
Methods inherited from Cms::Portlet
columns_for_index, connectable?, default_template, default_template_path, enable_template_editor, form, get_subclass, handler, has_edit_link?, #inline_options, #instance_name, #page_title, #portlet_type_name, render_inline, set_default_template_path, #store_errors_in_flash, #store_hash_in_flash, #store_params_in_flash, #type_name, types, #url_for_failure, #url_for_success
Instance Method Details
#render ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/portlets/forgot_password_portlet.rb', line 6 def render logger.warn "Handling Class #{request.class}" logger.warn "Handling FORGOT as #{request.method}" logger.warn "Am I a POST? #{request.post?}" flash[:forgot_password] = {} return unless request.post? user = Cms::User.find_by_email(params[:email]) logger.warn "Send email " unless user flash[:forgot_password][:error] = "We were unable to verify your account. Please make sure your email address is accurate." return end user.reset_token = generate_reset_token if user.save flash[:forgot_password][:notice] = "Your password has been sent to #{params[:email]}" Cms::ForgotPasswordMailer.deliver_reset_password(self.reset_password_url + '?token=' + user.reset_token, user.email) end end |