FIX: allow some auth token misses prior to clearing cookie

It appears that in some cases ios queues up requests up front
and "releases" them when tab gets focus, this allows for a certain
number of cookie misses for this case. Otherwise you get logged off.
This commit is contained in:
Sam Saffron
2017-02-22 12:36:58 -05:00
parent 3532957ce1
commit b7d2edc7dc
2 changed files with 19 additions and 3 deletions

View File

@ -201,9 +201,15 @@ describe Auth::DefaultCurrentUserProvider do
it "correctly removes invalid cookies" do
cookies = {"_t" => "BAAAD"}
provider('/').refresh_session(nil, {}, cookies)
cookies = {"_t" => SecureRandom.hex}
(Auth::DefaultCurrentUserProvider::MAX_COOKIE_MISSES).times do
provider('/').refresh_session(nil, {}, cookies)
end
expect(cookies.key?("_t")).to eq(true)
provider('/').refresh_session(nil, {}, cookies)
expect(cookies.key?("_t")).to eq(false)
end