rinkplanner/hub/views/account.php
torsten 9819311403 feat: Website und Hub zweisprachig (Deutsch/Englisch)
Website (rinkplanner.programmschmiede.de) liegt jetzt im Repo unter web/:
Sprachweiche nach Accept-Language (der User-Agent enthält keine Sprache),
/de/ und /en/ als eigene URLs mit hreflang, Cookie für die manuelle Wahl,
Texte in web/i18n.php, Markup in web/template.php. Deployment über
tools/deploy_web.sh (--sync, --check, --all); /index.html leitet weiter.

Hub: optionale englische Oberfläche über den DE/EN-Umschalter, Cookie
RHUB_LANG, Route /language. Alle Texte (Views, Meldungen, Validierung,
API-messages) stehen in hub/app/i18n_strings.php und laufen über t();
Datum und Zahlen folgen der Sprache. Die API behält ihre code-Felder und
antwortet ohne Cookie weiter deutsch.

deploy_hub.sh --check prüft jetzt Schlüsselparität und fehlende t()-Schlüssel.
Doku: docs/website.md neu, docs/hub.md und AGENTS.md ergänzt.
2026-11-12 22:38:32 +01:00

84 lines
3.9 KiB
PHP

<?php /** @var array $tokens */ ?>
<?php $user = auth_user(); ?>
<section class="page-head">
<div>
<h1><?= e(t('account.title')) ?></h1>
<p class="muted"><?= e($user['username']) ?> · <?= e($user['role'] === 'admin' ? t('account.role_admin') : t('account.role_user')) ?></p>
</div>
</section>
<?php if ($user['must_change_password'] === 1): ?>
<div class="flash flash-info"><?= e(t('account.must_change')) ?></div>
<?php endif; ?>
<div class="columns">
<section class="panel">
<h2><?= e(t('account.change_password')) ?></h2>
<form method="post" action="<?= e(url('/account/password')) ?>" class="stack">
<?= csrf_field() ?>
<label>
<?= e(t('account.current_password')) ?>
<input type="password" name="current_password" autocomplete="current-password" required>
</label>
<label>
<?= e(t('account.new_password')) ?>
<input type="password" name="password" autocomplete="new-password" required>
<span class="hint"><?= e(t('account.password_hint')) ?></span>
</label>
<label>
<?= e(t('account.repeat_password')) ?>
<input type="password" name="password_repeat" autocomplete="new-password" required>
</label>
<button class="primary" type="submit"><?= e(t('account.save_password')) ?></button>
</form>
</section>
<section class="panel">
<h2><?= e(t('account.tokens')) ?></h2>
<p class="muted"><?= e(t('account.tokens_lede')) ?></p>
<form method="post" action="<?= e(url('/account/tokens')) ?>" class="inline-form">
<?= csrf_field() ?>
<input type="text" name="name" maxlength="64" placeholder="<?= e_attr(t('account.token_placeholder')) ?>" required>
<button type="submit"><?= e(t('account.token_create')) ?></button>
</form>
<?php if ($tokens): ?>
<div class="table-wrap">
<table class="list compact">
<thead>
<tr>
<th><?= e(t('table.name')) ?></th>
<th><?= e(t('table.prefix')) ?></th>
<th><?= e(t('table.created')) ?></th>
<th><?= e(t('table.last_used')) ?></th>
<th><?= e(t('table.status')) ?></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($tokens as $token): ?>
<tr>
<td><?= e($token['name']) ?></td>
<td><code><?= e($token['prefix']) ?>…</code></td>
<td><?= e(fmt_dt($token['created_at'])) ?></td>
<td><?= e(fmt_dt($token['last_used_at'])) ?></td>
<td><?= e($token['revoked_at'] !== null ? t('account.token_revoked') : t('account.token_active')) ?></td>
<td>
<?php if ($token['revoked_at'] === null): ?>
<form class="inline" method="post" action="<?= e(url('/account/tokens/revoke')) ?>">
<?= csrf_field() ?>
<input type="hidden" name="token_id" value="<?= (int) $token['id'] ?>">
<button class="link-button danger" type="submit"><?= e(t('account.token_revoke')) ?></button>
</form>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p class="muted small"><?= e(t('account.no_tokens')) ?></p>
<?php endif; ?>
</section>
</div>