shared frontend, UserAPI invalidate sessions, bugfixes, stuff

This commit is contained in:
2023-02-09 23:55:30 +01:00
parent 8a09fc1f2d
commit 5acd13b945
15 changed files with 164 additions and 78 deletions

View File

@@ -211,4 +211,16 @@ class Context {
public function getLanguage(): Language {
return $this->language;
}
public function invalidateSessions(bool $keepCurrent = true): bool {
$query = $this->sql->update("Session")
->set("active", false)
->whereEq("user_id", $this->user->getId());
if (!$keepCurrent && $this->session !== null) {
$query->whereNeq("id", $this->session->getId());
}
return $query->execute();
}
}

View File

@@ -36,6 +36,10 @@ class KeyBasedTwoFactorToken extends TwoFactorToken {
return $token;
}
public function hasChallenge(): bool {
return isset($this->challenge);
}
public function getChallenge(): string {
return $this->challenge;
}