Commit e0597126 authored by jplang's avatar jplang

Don't compare timestamps with 0, triggers SQL errors with PostgreSQL (#10840).

git-svn-id: https://svn.redmine.org/redmine/trunk@16175 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent a05ebc0f
......@@ -48,7 +48,8 @@ class Token < ActiveRecord::Base
# Return true if token has expired
def expired?
return created_on < self.class.invalid_when_created_before(action)
validity_time = self.class.invalid_when_created_before(action)
validity_time.present? && created_on < validity_time
end
def max_instances
......@@ -63,9 +64,7 @@ class Token < ActiveRecord::Base
validity_time = self.validity_time
end
if validity_time.nil?
0
else
if validity_time
Time.now - validity_time
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment