summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/account.html.ep10
-rw-r--r--templates/change_password.html.ep69
2 files changed, 74 insertions, 5 deletions
diff --git a/templates/account.html.ep b/templates/account.html.ep
index 99178d9..dd808a6 100644
--- a/templates/account.html.ep
+++ b/templates/account.html.ep
@@ -39,6 +39,10 @@
<td><%= $acc->{email} %></td>
</tr>
<tr>
+ <th scope="row">Passwort</th>
+ <td><a href="/change_password" class="waves-effect waves-light btn">ändern</a></td>
+ </tr>
+ <tr>
<th scope="row">Registriert am</th>
<td><%= $acc->{registered_at}->strftime('%d.%m.%Y %H:%M') %></td>
</tr>
@@ -46,9 +50,7 @@
</div>
</div>
<div class="row">
- <div class="col s1 m1 l3">
- </div>
- <div class="col s10 m10 l6 center-align">
+ <div class="col s12 m12 l12 center-align">
%= form_for 'logout' => begin
%= csrf_field
<button class="btn waves-effect waves-light" type="submit" name="action" value="logout">
@@ -56,8 +58,6 @@
</button>
%= end
</div>
- <div class="col s1 m1 l3">
- </div>
</div>
% my $token = get_api_token();
diff --git a/templates/change_password.html.ep b/templates/change_password.html.ep
new file mode 100644
index 0000000..bae28d9
--- /dev/null
+++ b/templates/change_password.html.ep
@@ -0,0 +1,69 @@
+% if (my $invalid = stash('invalid')) {
+ <div class="row">
+ <div class="col s12">
+ <div class="card red darken-4">
+ <div class="card-content white-text">
+ % if ($invalid eq 'csrf') {
+ <span class="card-title">Ungültiger CSRF-Token</span>
+ <p>Sind Cookies aktiviert? Ansonsten könnte es sich um einen
+ Fall von <a
+ href="https://de.wikipedia.org/wiki/Cross-Site-Request-Forgery">CSRF</a>
+ handeln.</p>
+ % }
+ % elsif ($invalid eq 'password_notequal') {
+ <span class="card-title">Passwort ungültig</span>
+ <p>Die angegebenen neuen Passwörter sind nicht identisch.</p>
+ % }
+ % elsif ($invalid eq 'password_short') {
+ <span class="card-title">Passwort zu kurz</span>
+ <p>Das neue Passwort muss mindestens acht Zeichen lang sein.</p>
+ % }
+ % elsif ($invalid eq 'password') {
+ <span class="card-title">Ungültiges Passwort</span>
+ <p>Das aktuelle Passwort wurde nicht korrekt eingegeben.</p>
+ % }
+ % else {
+ <span class="card-title">Unbekannter Fehler</span>
+ <p>„<%= $invalid %>“</p>
+ % }
+ </div>
+ </div>
+ </div>
+ </div>
+% }
+
+<h1>Passwort ändern</h1>
+%= form_for '/change_password' => (method => 'POST') => begin
+ %= csrf_field
+ <div class="row">
+ <div class="input-field col s12">
+ <i class="material-icons prefix">lock</i>
+ %= password_field 'oldpw', id => 'oldpassword', class => 'validate', required => undef, autocomplete => 'current-password'
+ <label for="oldpassword">Aktuelles Passwort</label>
+ </div>
+ </div>
+ <div class="row">
+ <div class="input-field col l6 m12 s12">
+ <i class="material-icons prefix">lock</i>
+ %= password_field 'newpw', id => 'password', class => 'validate', required => undef, minlength => 8, autocomplete => 'new-password'
+ <label for="password">Neues Passwort</label>
+ </div>
+ <div class="input-field col l6 m12 s12">
+ <i class="material-icons prefix">lock</i>
+ %= password_field 'newpw2', id => 'password2', class => 'validate', required => undef, minlength => 8, autocomplete => 'new-password'
+ <label for="password2">Passwort wiederholen</label>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col s3 m3 l3">
+ </div>
+ <div class="col s6 m6 l6 center-align">
+ <button class="btn waves-effect waves-light" type="submit" name="action" value="login">
+ Ändern
+ <i class="material-icons right">send</i>
+ </button>
+ </div>
+ <div class="col s3 m3 l3">
+ </div>
+ </div>
+%= end