]> source.dussan.org Git - redmine.git/commitdiff
Code cleanup.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 7 Jul 2012 18:05:32 +0000 (18:05 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 7 Jul 2012 18:05:32 +0000 (18:05 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9942 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/account_controller.rb

index ea3dcb1ae8fa26a9ade4e2c05e2d0faa21c8861c..7d57b45da57f8f1cec69c58893680dae08175d83 100644 (file)
@@ -40,19 +40,22 @@ class AccountController < ApplicationController
     redirect_to home_url
   end
 
-  # Enable user to choose a new password
+  # Lets user choose a new password
   def lost_password
     redirect_to(home_url) && return unless Setting.lost_password?
     if params[:token]
-      @token = Token.find_by_action_and_value("recovery", params[:token])
-      redirect_to(home_url) && return unless @token and !@token.expired?
+      @token = Token.find_by_action_and_value("recovery", params[:token].to_s)
+      if @token.nil? || @token.expired?
+        redirect_to home_url
+        return
+      end
       @user = @token.user
       if request.post?
         @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
         if @user.save
           @token.destroy
           flash[:notice] = l(:notice_account_password_updated)
-          redirect_to :action => 'login'
+          redirect_to signin_path
           return
         end
       end