##// END OF EJS Templates
Workaround for timestamps rounding issues with Rails4.2 and mysql5.7 that may kill user session after password is changed (#17460)....
Jean-Philippe Lang -
r13629:76e7025f0716
parent child
Show More
@@ -102,7 +102,7 class MyController < ApplicationController
102 if @user.save
102 if @user.save
103 # Reset the session creation time to not log out this session on next
103 # Reset the session creation time to not log out this session on next
104 # request due to ApplicationController#force_logout_if_password_changed
104 # request due to ApplicationController#force_logout_if_password_changed
105 session[:ctime] = Time.now.utc.to_i
105 session[:ctime] = User.current.passwd_changed_on.utc.to_i
106 flash[:notice] = l(:notice_account_password_updated)
106 flash[:notice] = l(:notice_account_password_updated)
107 redirect_to my_account_path
107 redirect_to my_account_path
108 end
108 end
@@ -314,7 +314,7 class User < Principal
314 def salt_password(clear_password)
314 def salt_password(clear_password)
315 self.salt = User.generate_salt
315 self.salt = User.generate_salt
316 self.hashed_password = User.hash_password("#{salt}#{User.hash_password clear_password}")
316 self.hashed_password = User.hash_password("#{salt}#{User.hash_password clear_password}")
317 self.passwd_changed_on = Time.now
317 self.passwd_changed_on = Time.now.change(:usec => 0)
318 end
318 end
319
319
320 # Does the backend storage allow this user to change their password?
320 # Does the backend storage allow this user to change their password?
General Comments 0
You need to be logged in to leave comments. Login now