LuminaWebsite/login.php
Maaxxs 525bd0d4b5 Gear planner: sets can be shared by link or build code and imported as your own
Asked for: share a build with a link or build code, and an import tool that takes such a code.

- "Teilen" on an own set creates a link (gear.php?build=CODE) and the same code as build code: 10
  characters without 0/O and 1/I/L, shown as K7QX2-M9FRT, stored in gear_sets.share_code (schema
  version 59, unique; also in sql/schema.sql). Whoever opens it sees the set even if it is not on the
  profile, always in its current state; the session remembers the code so tabs, slots and compare
  work, and a renewed or withdrawn code ends that access. "Neuen Code erzeugen" and "Nicht mehr
  teilen" invalidate the old one. The dialog reopens after creating (#teilen) with copy buttons.
- "Build importieren" on "Meine Sets" takes the code (with or without dash, any case) or the whole
  link; viewing someone else's set (shared or on the profile) offers "In meine Sets übernehmen".
  Both copy the set with gear, skills, macros and all planner pages via gear_set_copy() (also used
  by "Kopieren" now); the copy is neither shared nor on the profile. Errors reopen the dialog (#import).
- Members only (gear.view). Opening any page without being logged in now brings you back to it after
  the login (auth_login_return_target) - only for page views in the browser, not for background
  requests like live updates or autosave.
- Privacy policy (shared sets), patch notes and README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 01:44:52 +02:00

60 lines
2.1 KiB
PHP

<?php
require_once __DIR__ . '/includes/bootstrap.php';
if ($user = current_user()) {
redirect($user['status'] === 'pending' ? '/pending.php' : '/dashboard.php');
}
$error = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
verify_csrf();
$username = trim((string) ($_POST['username'] ?? ''));
$password = (string) ($_POST['password'] ?? '');
if ($username === '' || $password === '') {
$error = 'Bitte Benutzername und Passwort eingeben.';
} else {
$error = attempt_login($username, $password);
if ($error === '') {
redirect(auth_login_return_target());
}
}
}
$pageTitle = 'Login';
include __DIR__ . '/includes/header.php';
?>
<div class="panel panel-narrow login-panel">
<h1>Login</h1>
<p class="text-muted">Melde dich mit deinem Discord-Account vom Legions-Server an.</p>
<a class="button discord-connect-button login-discord-button" href="/discord_login.php">
<?= discord_logo(22) ?> Mit Discord einloggen
</a>
<p class="login-privacy text-muted">
Beim Login übernimmt die Website von Discord deine Discord-ID, deinen Namen, dein Profilbild
und deine Rollen auf unserem Server. Mehr dazu in der <a href="/datenschutz.php#discord-login">Datenschutzerklärung</a>.
</p>
<details class="login-password"<?= $error ? ' open' : '' ?>>
<summary>Mit Benutzername und Passwort anmelden</summary>
<?php if ($error): ?>
<div class="flash flash-error"><?= e($error) ?></div>
<?php endif; ?>
<form method="post" action="/login.php">
<?= csrf_field() ?>
<div>
<label for="username">Benutzername</label>
<input type="text" id="username" name="username" required value="<?= e($_POST['username'] ?? '') ?>">
</div>
<div>
<label for="password">Passwort</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit" class="button-secondary">Anmelden</button>
</form>
</details>
</div>
<?php include __DIR__ . '/includes/footer.php'; ?>