Class ForgotPasswordPortlet
In: app/portlets/forgot_password_portlet.rb
Parent: Portlet

Methods

render  

Public Instance methods

[Source]

    # File app/portlets/forgot_password_portlet.rb, line 5
 5:   def render
 6:     flash[:forgot_password] = {}
 7: 
 8:     return unless request.method == :post
 9:     user = User.find_by_email(params[:email])
10:     
11:     unless user
12:       flash[:forgot_password][:error] = "We were unable to verify your account. Please make sure your email address is accurate."
13:       return
14:     end
15:     
16:     user.reset_token = generate_reset_token
17:     if user.save
18:       flash[:forgot_password][:notice] = "Your password has been sent to #{params[:email]}"
19:       ForgotPasswordMailer.deliver_reset_password(self.reset_password_url + '?token=' + user.reset_token, user.email)
20:     end
21:   end

[Validate]