X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/52e5fa6ad78f375cec5a207a123a4aa3939c8ddf..1d49b0d71df85ca7f6d049c2ccd2bed0999f2a79:/app/models/user_token.rb?ds=inline diff --git a/app/models/user_token.rb b/app/models/user_token.rb index dda191187..faa540e67 100644 --- a/app/models/user_token.rb +++ b/app/models/user_token.rb @@ -3,10 +3,14 @@ class UserToken < ActiveRecord::Base after_initialize :set_defaults -private + def expired? + expiry < Time.now + end + + private def set_defaults - self.token = OSM::make_token() if self.token.blank? - self.expiry = 1.week.from_now if self.expiry.blank? + self.token = OSM.make_token if token.blank? + self.expiry = 1.week.from_now if expiry.blank? end end