]> source.dussan.org Git - redmine.git/commitdiff
Workaround for timestamps rounding issues with Rails4.2 and mysql5.7 that may kill...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 15 Feb 2015 09:09:35 +0000 (09:09 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 15 Feb 2015 09:09:35 +0000 (09:09 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14011 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/my_controller.rb
app/models/user.rb

index 8ef263ebc107a65b16f07d64909fb16e87841096..982541db1f25c814c1a84bf831e6252aedc4cc91 100644 (file)
@@ -102,7 +102,7 @@ class MyController < ApplicationController
         if @user.save
           # Reset the session creation time to not log out this session on next
           # request due to ApplicationController#force_logout_if_password_changed
-          session[:ctime] = Time.now.utc.to_i
+          session[:ctime] = User.current.passwd_changed_on.utc.to_i
           flash[:notice] = l(:notice_account_password_updated)
           redirect_to my_account_path
         end
index 2175d06822b59b13072d6a48c4e11ef4003dc2b0..8811a65fd9d5600b34508fe33f157e386e619783 100644 (file)
@@ -314,7 +314,7 @@ class User < Principal
   def salt_password(clear_password)
     self.salt = User.generate_salt
     self.hashed_password = User.hash_password("#{salt}#{User.hash_password clear_password}")
-    self.passwd_changed_on = Time.now
+    self.passwd_changed_on = Time.now.change(:usec => 0)
   end
 
   # Does the backend storage allow this user to change their password?