Warn at startup when no user exists and no bootstrap admin is configured

Also document that Sec-Fetch-Site is only sent over HTTPS, so plain-HTTP
LAN access relies on SameSite=Lax alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Grovy311 2026-09-28 21:47:30 +02:00
parent 95bfba2f67
commit 728132e52a
2 changed files with 7 additions and 1 deletions

View file

@ -63,9 +63,14 @@ export class UserService {
// Warm the dummy hash at startup so even the first unknown-user login
// costs one scrypt run, not two.
await this.getDummyHash();
if (!this.authConfig.bootstrap) return;
const existingCount = await this.repository.count();
if (existingCount > 0) return;
if (!this.authConfig.bootstrap) {
logger.warn(
"no users exist and AUTH_BOOTSTRAP_USERNAME/AUTH_BOOTSTRAP_PASSWORT are not set - nobody can sign in"
);
return;
}
const passwordHash = await hashPassword(this.authConfig.bootstrap.password);
await this.repository.create({
username: this.authConfig.bootstrap.username,