Skip to content

Commit

Permalink
Fix: Wipe navigation fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxantron committed Feb 11, 2019
1 parent fdbaa3f commit 7ebfe7a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/controllers/session-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ public function requiresPassword($id = 0)
// URL: /api/session/membercheck/{id}/{mid}
public function membercheck($sid, $mid)
{
$session = $this->getSession($sid);
try{
$session = $this->getSession($sid);
}
catch(Exception $e){
return new BoolResponse();
}
foreach($session->getMembers() as $member) {
if($member->getId() == $mid) {
return new BoolResponse(true);
Expand Down Expand Up @@ -232,7 +237,15 @@ public function wipe($id)
$session = $this->getSession($id);
if (!$this->verifyToken($session))
return;
// Remove session and wipe
// Clear and wipe polls
$session->setCurrentPoll(null);
foreach($session->getPolls() as $poll)
$this->entityManager->remove($poll);
// Wipe all members
foreach($session->getMembers() as $member)
$this->entityManager->remove($member);
$this->entityManager->flush();
// Remove session object
$this->entityManager->remove($session);
$this->entityManager->flush();
}
Expand Down

0 comments on commit 7ebfe7a

Please sign in to comment.