Commit 2b9e1360 authored by Leandro Nunes's avatar Leandro Nunes

Merge branch 'participa/noosfero-remove_token_expired'

parents e9c353c4 1323bbe9
......@@ -170,11 +170,6 @@ class User < ActiveRecord::Base
end
end
TOKEN_VALIDITY = 2.weeks
def private_token_expired?
self.private_token.nil? || (self.private_token_generated_at + TOKEN_VALIDITY < DateTime.now)
end
# Activates the user in the database.
def activate
return false unless self.person
......
......@@ -23,7 +23,6 @@ require_relative '../../find_by_contents'
def current_user
private_token = (params[PRIVATE_TOKEN_PARAM] || headers['Private-Token']).to_s
@current_user ||= User.find_by_private_token(private_token)
@current_user = nil if !@current_user.nil? && @current_user.private_token_expired?
@current_user
end
......
......@@ -733,17 +733,6 @@ class UserTest < ActiveSupport::TestCase
assert user.private_token, 'token'
end
should 'check for private token validity' do
user = User.new
assert user.private_token_expired?
user.generate_private_token!
assert !user.private_token_expired?
user.private_token_generated_at = DateTime.now - (User::TOKEN_VALIDITY + 1.minute)
assert user.private_token_expired?
end
protected
def new_user(options = {})
user = User.new({ :login => 'quire', :email => '[email protected]', :password => 'quire', :password_confirmation => 'quire' }.merge(options))
......
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