##// END OF EJS Templates
Do not autologin if more that one token is found (#3351)....
Jean-Philippe Lang -
r2643:b87753c90d2b
parent child
Show More
@@ -128,10 +128,14 class User < ActiveRecord::Base
128 128
129 129 # Returns the user who matches the given autologin +key+ or nil
130 130 def self.try_to_autologin(key)
131 token = Token.find_by_action_and_value('autologin', key)
132 if token && (token.created_on > Setting.autologin.to_i.day.ago) && token.user && token.user.active?
133 token.user.update_attribute(:last_login_on, Time.now)
134 token.user
131 tokens = Token.find_all_by_action_and_value('autologin', key)
132 # Make sure there's only 1 token that matches the key
133 if tokens.size == 1
134 token = tokens.first
135 if (token.created_on > Setting.autologin.to_i.day.ago) && token.user && token.user.active?
136 token.user.update_attribute(:last_login_on, Time.now)
137 token.user
138 end
135 139 end
136 140 end
137 141
General Comments 0
You need to be logged in to leave comments. Login now