Skip to content

Commit

Permalink
Test for isActive when getting saved session
Browse files Browse the repository at this point in the history
  • Loading branch information
Benau committed Nov 25, 2018
1 parent c5c1a22 commit 04af978
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/ClientSession.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ public function setOnline(bool $online = true)
* @param int $user_id user id
*
* @return ClientSession
* @throws ClientSessionExpiredException|ClientSessionException when session does not exist
* @throws ClientSessionExpiredException|ClientSessionException|UserException
when session does not exist, or when account is not active
*/
public static function get(string $session_id, int $user_id)
{
Expand Down Expand Up @@ -615,7 +616,10 @@ public static function get(string $session_id, int $user_id)
}

// here an if statement will come for Guest and registered
return new static($session_info[0]["cid"], User::getFromID($user_id));
$user = User::getFromID($user_id);
if (!$user->isActive())
throw new UserException(_h("Your account is not active"), ErrorType::USER_INACTIVE_ACCOUNT);
return new static($session_info[0]["cid"], $user);
}

/**
Expand Down

0 comments on commit 04af978

Please sign in to comment.