ごめん
This commit is contained in:
@@ -158,6 +158,10 @@ class User {
|
||||
$auth = new Auth;
|
||||
$user = $auth->getLoggedInUser();
|
||||
$u = $auth->getUser($name);
|
||||
if (!$u) {
|
||||
header('Location: /404');
|
||||
exit();
|
||||
}
|
||||
|
||||
$tmpl = new Template('/');
|
||||
$pagetit = 'サインイン';
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user