ごめん

This commit is contained in:
2025-12-12 01:01:36 +09:00
parent 72f3f5d39b
commit 667ac47af0
2 changed files with 8 additions and 2 deletions

View File

@@ -34,8 +34,9 @@ class Auth {
return $this->pubUser;
}
public function getUser(string $name): \stdClass {
public function getUser(string $name): \stdClass|null {
$user = $this->getUserDataFromName($name);
if (!$user) return null;
unset($user->password);
unset($user->tokens);
$myself = $this->getUserData();
@@ -306,7 +307,7 @@ class Auth {
return json_decode($lines);
}
private function getUserDataFromName(string $name): \stdClass {
private function getUserDataFromName(string $name): \stdClass|null {
if (!AUTH_ENABLED) return new \stdClass;
$file = scandir($this->dataDir);
$userFile = "";
@@ -321,6 +322,7 @@ class Auth {
}
}
}
if (!$userFile) return null;
$path = $this->dataDir.$userFile;
unset($file, $userFile);