Skip to content

Commit

Permalink
Fix password reset code
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Feb 23, 2010
1 parent fd98bd2 commit c928865
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,17 @@ def activate

def forgot
if request.post?
user = User.find_by_email(params[:user][:email])

if user
if (user = User.find_by_email(params[:user][:email])).present?
user.create_reset_code

begin
flash[:notice] = "An email has been sent to #{user.email} with a link to reset your password."
UserMailer.deliver_reset_notification(user, request)
rescue
info.logger "error: email could not be sent for user password reset"
logger.info "Error: email could not be sent for user password reset for user #{user.id} with email #{user.email}"
end
else
flash[:notice] = "Sorry, #{params[:user][:email]} isn't associated with any acounts. Are you sure you typed the correct email address?"
flash[:notice] = "Sorry, #{params[:user][:email]} isn't associated with any accounts. Are you sure you typed the correct email address?"
end

redirect_back_or_default(forgot_url)
Expand Down

0 comments on commit c928865

Please sign in to comment.