Fix setup/auth flow and harden storage write failures
This commit is contained in:
@@ -69,7 +69,13 @@ final class UserRepository
|
||||
|
||||
$this->write(['users' => $users]);
|
||||
|
||||
return $this->find($normalized) ?? [];
|
||||
$createdUser = $this->find($normalized);
|
||||
|
||||
if ($createdUser === null) {
|
||||
throw new RuntimeException('Der Account konnte nicht gespeichert werden.');
|
||||
}
|
||||
|
||||
return $createdUser;
|
||||
}
|
||||
|
||||
public function changePassword(string $username, string $password): void
|
||||
@@ -94,9 +100,14 @@ final class UserRepository
|
||||
mkdir(dirname($this->path), 0775, true);
|
||||
}
|
||||
|
||||
file_put_contents(
|
||||
$bytes = file_put_contents(
|
||||
$this->path,
|
||||
json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
||||
json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
|
||||
LOCK_EX
|
||||
);
|
||||
|
||||
if ($bytes === false) {
|
||||
throw new RuntimeException('Die Benutzerdatei konnte nicht geschrieben werden. Bitte prüfe die Schreibrechte von storage/system.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user