mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Don't compare timestamps with 0, triggers SQL errors with PostgreSQL (#10840).
git-svn-id: http://svn.redmine.org/redmine/trunk@16175 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5d4b5fd1f6
commit
82d96258f4
@ -48,7 +48,8 @@ class Token < ActiveRecord::Base
|
|||||||
|
|
||||||
# Return true if token has expired
|
# Return true if token has expired
|
||||||
def 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
|
end
|
||||||
|
|
||||||
def max_instances
|
def max_instances
|
||||||
@ -63,9 +64,7 @@ class Token < ActiveRecord::Base
|
|||||||
validity_time = self.validity_time
|
validity_time = self.validity_time
|
||||||
end
|
end
|
||||||
|
|
||||||
if validity_time.nil?
|
if validity_time
|
||||||
0
|
|
||||||
else
|
|
||||||
Time.now - validity_time
|
Time.now - validity_time
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user