Commit c3f4eb07735602298155015ca83ef4df44ac1758
1 parent
2314732f
Exists in
stable-spb-1.4
and in
5 other branches
Remove api expired token
Showing
3 changed files
with
1 additions
and
17 deletions
Show diff stats
app/models/user.rb
... | ... | @@ -169,11 +169,6 @@ class User < ActiveRecord::Base |
169 | 169 | end |
170 | 170 | end |
171 | 171 | |
172 | - TOKEN_VALIDITY = 2.weeks | |
173 | - def private_token_expired? | |
174 | - self.private_token.nil? || (self.private_token_generated_at + TOKEN_VALIDITY < DateTime.now) | |
175 | - end | |
176 | - | |
177 | 172 | # Activates the user in the database. |
178 | 173 | def activate |
179 | 174 | return false unless self.person | ... | ... |
lib/noosfero/api/helpers.rb
... | ... | @@ -23,7 +23,7 @@ require_relative '../../find_by_contents' |
23 | 23 | def current_user |
24 | 24 | private_token = (params[PRIVATE_TOKEN_PARAM] || headers['Private-Token']).to_s |
25 | 25 | @current_user ||= User.find_by_private_token(private_token) |
26 | - @current_user = nil if !@current_user.nil? && @current_user.private_token_expired? | |
26 | + @current_user = nil if !@current_user.nil? | |
27 | 27 | @current_user |
28 | 28 | end |
29 | 29 | ... | ... |
test/unit/user_test.rb
... | ... | @@ -733,17 +733,6 @@ class UserTest < ActiveSupport::TestCase |
733 | 733 | assert user.private_token, 'token' |
734 | 734 | end |
735 | 735 | |
736 | - should 'check for private token validity' do | |
737 | - user = User.new | |
738 | - assert user.private_token_expired? | |
739 | - | |
740 | - user.generate_private_token! | |
741 | - assert !user.private_token_expired? | |
742 | - | |
743 | - user.private_token_generated_at = DateTime.now - (User::TOKEN_VALIDITY + 1.minute) | |
744 | - assert user.private_token_expired? | |
745 | - end | |
746 | - | |
747 | 736 | protected |
748 | 737 | def new_user(options = {}) |
749 | 738 | user = User.new({ :login => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire' }.merge(options)) | ... | ... |