rpg-westreiche/westreiche_website/views/account.php

67 lines
2.5 KiB
PHP
Raw Normal View History

<?php
/** @var array $account */
/** @var string $error */
?>
<div class="page-head">
<div>
<h1>Mein Konto</h1>
<p class="lede">Benutzername <b><?= e((string) $account['username']) ?></b> · Rolle
<?= $account['role'] === 'admin' ? 'Spielleiter (alle Rechte)' : 'Spieler' ?>
</p>
</div>
</div>
<?php if ($error !== ''): ?>
<p class="alert alert-error"><?= e($error) ?></p>
<?php endif; ?>
<?php if ((int) $account['must_change_password'] === 1): ?>
<p class="alert alert-info">Bitte vergib zuerst ein eigenes Passwort, bevor du Charaktere pflegst.</p>
<?php endif; ?>
<section class="panel">
<h2>Profil</h2>
<form method="post" action="<?= e(url('/account')) ?>" class="form-grid">
<?= csrf_field() ?>
<input type="hidden" name="action" value="profile">
<div class="grid-2">
<label class="field">
<span>Anzeigename</span>
<input type="text" name="display_name" value="<?= e((string) $account['display_name']) ?>" maxlength="120">
</label>
<label class="field">
<span>E-Mail (auch als Login möglich)</span>
<input type="email" name="email" value="<?= e((string) ($account['email'] ?? '')) ?>" maxlength="190">
</label>
</div>
<div class="actions">
<button class="btn" type="submit">Profil speichern</button>
</div>
</form>
</section>
<section class="panel">
<h2>Passwort ändern</h2>
<form method="post" action="<?= e(url('/account')) ?>" class="form-grid">
<?= csrf_field() ?>
<input type="hidden" name="action" value="password">
<div class="grid-3">
<label class="field">
<span>Aktuelles Passwort</span>
<input type="password" name="current_password" required autocomplete="current-password">
</label>
<label class="field">
<span>Neues Passwort</span>
<input type="password" name="new_password" required minlength="8" autocomplete="new-password">
</label>
<label class="field">
<span>Neues Passwort wiederholen</span>
<input type="password" name="new_password_repeat" required minlength="8" autocomplete="new-password">
</label>
</div>
<div class="actions">
<button class="btn btn-primary" type="submit">Passwort ändern</button>
</div>
</form>
</section>