PR feedback and a manual test

This commit is contained in:
Kevin Darby committed 2019-06-10 12:46:37 -04:00
1 parent e8b5d4f8fd
commit af365177d0
5 files changed
+97 -66

No files matched your search

+9 -10
View File
@@ -42,12 +42,7 @@ AuthSessionManager::AuthSessionManager() : _map(), _nusers(), _expiration()
bts_assert_msg(valid, "Your BTS Keycode is invalid");
_nusers = kc.nusers();
_expiration = kc.expiration();
auto current = datetime::ll_diff_in_us(datetime::ll_now(), _expiration) > 0;
if(!current)
LOG(Gen,Error, "Your BTS Keycode is expired");
bts_assert_msg(current, "Your BTS Keycode is EXPIRED");
_expiration = kc.expiration();
}
@@ -56,6 +51,11 @@ bool AuthSessionManager::add_or_replace_session(const api::user::TokenPayload& t
{
if(tok.wheel())
return true;
if(datetime::ll_diff_in_us(datetime::ll_now(), _expiration) < 0)
{
LOG(Gen,Error, "Your BTS Keycode is expired!");
return false;
}
auto it = _map.find(tok.id());
if(it != _map.end())
{
@@ -72,11 +72,10 @@ bool AuthSessionManager::add_or_replace_session(const api::user::TokenPayload& t
bool AuthSessionManager::check_session(const api::user::TokenPayload& tok)
{
auto now = datetime::ll_now();
if(datetime::ll_diff_in_us(now, _expiration) > 0)
if(tok.wheel())
return true;
if(datetime::ll_diff_in_us(datetime::ll_now(), _expiration) > 0)
{
if(tok.wheel())
return true;
auto it = _map.find(tok.id());
if(it != _map.end())
{