Class: Token
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Token
- Defined in:
- app/models/token.rb
Overview
Redmine - project management software Copyright (C) 2006-2009 Jean-Philippe Lang
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Constant Summary
- @@validity_time =
1.day
Class Method Summary
-
+ (Object) destroy_expired
Delete all expired tokens.
Instance Method Summary
- - (Object) before_create
-
- (Boolean) expired?
Return true if token has expired.
Methods inherited from ActiveRecord::Base
Class Method Details
+ (Object) destroy_expired
Delete all expired tokens
36 37 38 |
# File 'app/models/token.rb', line 36 def self.destroy_expired Token.delete_all ["action <> 'feeds' AND created_on < ?", Time.now - @@validity_time] end |
Instance Method Details
- (Object) before_create
26 27 28 |
# File 'app/models/token.rb', line 26 def before_create self.value = Token.generate_token_value end |
- (Boolean) expired?
Return true if token has expired
31 32 33 |
# File 'app/models/token.rb', line 31 def expired? return Time.now > self.created_on + @@validity_time end |