2019-03-18 17:55:39 +00:00
|
|
|
|
% 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') {
|
|
|
|
|
<span class="card-title">Ungültiges Passwort</span>
|
|
|
|
|
<p>Aus Sicherheitsgründen kann der Account nur nach Passworteingabe
|
|
|
|
|
gelöscht werden.</p>
|
|
|
|
|
% }
|
|
|
|
|
% else {
|
|
|
|
|
<span class="card-title">Unbekannter Fehler</span>
|
|
|
|
|
<p>„<%= $invalid %>“</p>
|
|
|
|
|
% }
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
% }
|
|
|
|
|
|
2019-03-03 21:35:20 +00:00
|
|
|
|
<h1>Account</h1>
|
2019-03-18 17:47:52 +00:00
|
|
|
|
% my $acc = current_user();
|
2019-03-03 21:35:20 +00:00
|
|
|
|
<div class="row">
|
2019-03-08 16:59:48 +00:00
|
|
|
|
<div class="col s12">
|
|
|
|
|
<table class="striped">
|
|
|
|
|
<tr>
|
|
|
|
|
<th scope="row">Name</th>
|
|
|
|
|
<td><%= $acc->{name} %></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<th scope="row">Mail</th>
|
|
|
|
|
<td><%= $acc->{email} %></td>
|
|
|
|
|
</tr>
|
2019-04-06 09:20:10 +00:00
|
|
|
|
<tr>
|
|
|
|
|
<th scope="row">Passwort</th>
|
|
|
|
|
<td><a href="/change_password" class="waves-effect waves-light btn">ändern</a></td>
|
|
|
|
|
</tr>
|
2019-03-08 16:59:48 +00:00
|
|
|
|
<tr>
|
|
|
|
|
<th scope="row">Registriert am</th>
|
|
|
|
|
<td><%= $acc->{registered_at}->strftime('%d.%m.%Y %H:%M') %></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
2019-04-06 09:20:10 +00:00
|
|
|
|
<div class="col s12 m12 l12 center-align">
|
2019-03-08 16:59:48 +00:00
|
|
|
|
%= form_for 'logout' => begin
|
|
|
|
|
%= csrf_field
|
|
|
|
|
<button class="btn waves-effect waves-light" type="submit" name="action" value="logout">
|
|
|
|
|
Abmelden
|
|
|
|
|
</button>
|
|
|
|
|
%= end
|
|
|
|
|
</div>
|
2019-03-03 21:35:20 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
2019-03-16 12:56:56 +00:00
|
|
|
|
% my $token = get_api_token();
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s12">
|
2019-03-16 13:17:02 +00:00
|
|
|
|
<h2>API</h2>
|
2019-03-16 12:56:56 +00:00
|
|
|
|
<p>
|
|
|
|
|
Die folgenden API-Token erlauben den passwortlosen automatisierten Zugriff auf
|
|
|
|
|
API-Endpunkte. Bitte umsichtig behandeln – sobald ein Token gesetzt
|
2019-03-16 13:17:02 +00:00
|
|
|
|
ist, können damit ohne Logindaten alle zugehörigen API-Aktionen
|
|
|
|
|
ausgeführt werden.
|
2019-03-16 12:56:56 +00:00
|
|
|
|
</p>
|
|
|
|
|
<table class="striped">
|
|
|
|
|
<tr>
|
|
|
|
|
<th scope="row">Status</th>
|
|
|
|
|
<td>
|
|
|
|
|
% if ($token->{status}) {
|
|
|
|
|
%= $acc->{id} . '-' . $token->{status}
|
|
|
|
|
% }
|
|
|
|
|
% else {
|
|
|
|
|
—
|
|
|
|
|
% }
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
%= form_for 'set_token' => begin
|
|
|
|
|
%= csrf_field
|
|
|
|
|
%= hidden_field 'token' => 'status'
|
|
|
|
|
<button class="btn waves-effect waves-light" type="submit" name="action" value="generate">
|
|
|
|
|
Generieren
|
|
|
|
|
</button>
|
|
|
|
|
<button class="btn waves-effect waves-light red" type="submit" name="action" value="delete">
|
|
|
|
|
Löschen
|
|
|
|
|
</button>
|
|
|
|
|
%= end
|
|
|
|
|
</td>
|
2019-04-06 11:58:10 +00:00
|
|
|
|
</tr><!--
|
2019-03-16 12:56:56 +00:00
|
|
|
|
<tr>
|
|
|
|
|
<th scope="row">History</th>
|
|
|
|
|
<td>
|
|
|
|
|
% if ($token->{history}) {
|
|
|
|
|
%= $acc->{id} . '-' . $token->{history}
|
|
|
|
|
% }
|
|
|
|
|
% else {
|
|
|
|
|
—
|
|
|
|
|
% }
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
%= form_for 'set_token' => begin
|
|
|
|
|
%= csrf_field
|
|
|
|
|
%= hidden_field 'token' => 'history'
|
|
|
|
|
<button class="btn waves-effect waves-light" type="submit" name="action" value="generate">
|
|
|
|
|
Generieren
|
|
|
|
|
</button>
|
|
|
|
|
<button class="btn waves-effect waves-light red" type="submit" name="action" value="delete">
|
|
|
|
|
Löschen
|
|
|
|
|
</button>
|
|
|
|
|
%= end
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<th scope="row">Travel</th>
|
|
|
|
|
<td>
|
|
|
|
|
% if ($token->{action}) {
|
|
|
|
|
%= $acc->{id} . '-' . $token->{action}
|
|
|
|
|
% }
|
|
|
|
|
% else {
|
|
|
|
|
—
|
|
|
|
|
% }
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
%= form_for 'set_token' => begin
|
|
|
|
|
%= csrf_field
|
|
|
|
|
%= hidden_field 'token' => 'action'
|
|
|
|
|
<button class="btn waves-effect waves-light" type="submit" name="action" value="generate">
|
|
|
|
|
Generieren
|
|
|
|
|
</button>
|
|
|
|
|
<button class="btn waves-effect waves-light red" type="submit" name="action" value="delete">
|
|
|
|
|
Löschen
|
|
|
|
|
</button>
|
|
|
|
|
%= end
|
|
|
|
|
</td>
|
2019-04-06 11:58:10 +00:00
|
|
|
|
</tr> -->
|
2019-03-16 12:56:56 +00:00
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
% my $api_root = $self->url_for('/api/v0')->to_abs->scheme('https');
|
2019-03-16 13:17:02 +00:00
|
|
|
|
<h3>Status</h3>
|
2019-03-16 12:56:56 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s12">
|
|
|
|
|
<p style="font-family: Monospace;">
|
|
|
|
|
% if ($token->{status}) {
|
|
|
|
|
curl <%= $api_root %>/status/<%= $acc->{id} %>-<%= $token->{status} // 'TOKEN' %>
|
|
|
|
|
% }
|
|
|
|
|
% else {
|
|
|
|
|
curl <%= $api_root %>/status/TOKEN
|
|
|
|
|
% }
|
|
|
|
|
</p>
|
2019-03-19 16:02:30 +00:00
|
|
|
|
<p>
|
|
|
|
|
Beispiel / Layout:
|
|
|
|
|
</p>
|
2019-03-16 12:56:56 +00:00
|
|
|
|
<p style="font-family: Monospace;">
|
|
|
|
|
{<br/>
|
2019-03-19 16:02:30 +00:00
|
|
|
|
"deprecated" : true / false, (falls true: Diese API-Version wird irgendwann abgeschaltet, bitte auf eine neue umsteigen)<br/>
|
2019-03-16 12:56:56 +00:00
|
|
|
|
"checked_in" : true / false,<br/>
|
2019-03-19 16:02:30 +00:00
|
|
|
|
"station" : {<br/>
|
|
|
|
|
"name" : "Essen Hbf", (Name der letzten Station)<br/>
|
|
|
|
|
"ds100" : "EE", (DS100-Kürzel)<br/>
|
|
|
|
|
"uic" : 8000098, (Internationale Bahnhofsnummer)<br/>
|
|
|
|
|
"longitude" : 7.014793,<br/>
|
|
|
|
|
"latitude" : 51.451355,<br/>
|
|
|
|
|
},<br/>
|
|
|
|
|
"train" : {<br/>
|
|
|
|
|
"type" : "ICE", (aktueller / letzter Zugtyp)<br/>
|
|
|
|
|
"line" : null, (Linie als String, nicht immer numerisch, ggf. null)<br/>
|
|
|
|
|
"no" : "1234", (Zugnummer als String)<br/>
|
|
|
|
|
},<br/>
|
2019-03-20 16:45:41 +00:00
|
|
|
|
"actionTime" : 1234567, (UNIX-Timestamp des letzten Checkin/Checkout)<br/>
|
|
|
|
|
"scheduledTime" : 1234567, (UNIX-Timestamp der zugehörigen Ankunft/Abfahrt gemäß Fahrplan. Ggf. 0)<br/>
|
|
|
|
|
"realTime" : 1234567, (UNIX-Timestamp der zugehörigen Ankunft/Abfahrt laut Echtzeitdaten. Ggf. 0)<br/>
|
2019-03-16 12:56:56 +00:00
|
|
|
|
}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
Im Fehlerfall: <span style="font-family: Monospace;">{ "error" : "Begründung" }</span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-04-06 11:58:10 +00:00
|
|
|
|
<!--
|
2019-03-16 13:17:02 +00:00
|
|
|
|
<h3>History</h3>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s12">
|
|
|
|
|
<p>
|
|
|
|
|
Coming soon.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<h3>Travel</h3>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s12">
|
|
|
|
|
<p>
|
|
|
|
|
Ein- und Auschecken per API. Coming soon.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-04-06 11:58:10 +00:00
|
|
|
|
-->
|
2019-03-16 13:17:02 +00:00
|
|
|
|
<h2>Export</h2>
|
2019-03-03 21:35:20 +00:00
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s12">
|
|
|
|
|
<ul>
|
2019-03-07 17:36:11 +00:00
|
|
|
|
<li><a href="/export.json">Rohdaten</a> (Kein API-Ersatz, das Format kann sich jederzeit ändern)</li>
|
2019-03-03 21:35:20 +00:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-03-12 20:49:26 +00:00
|
|
|
|
|
|
|
|
|
% if (not $acc->{deletion_requested}) {
|
2019-03-16 13:17:02 +00:00
|
|
|
|
<h2>Löschen</h2>
|
2019-03-12 20:49:26 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s12">
|
|
|
|
|
<p>
|
2019-03-16 13:17:02 +00:00
|
|
|
|
Der Löschauftrag wird vorgemerkt und erst nach drei Tagen
|
|
|
|
|
umgesetzt, bis dahin kann er jederzeit zurückgenommen werden. Nach
|
|
|
|
|
Ablauf der drei Tage wird der Account mit allen zugehörigen
|
|
|
|
|
Reisedaten ohne weitere Rückfragen entfernt.
|
2019-03-12 20:49:26 +00:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
2019-03-18 17:55:39 +00:00
|
|
|
|
%= form_for 'delete' => begin
|
|
|
|
|
<div class="input-field col s12 m12 l8">
|
|
|
|
|
<i class="material-icons prefix">lock</i>
|
|
|
|
|
%= password_field 'password', id => 'password', class => 'validate', required => undef, autocomplete => 'current-password'
|
|
|
|
|
<label for="password">Passwort</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="input-field col s12 m12 l4 center-align">
|
2019-03-12 20:49:26 +00:00
|
|
|
|
%= csrf_field
|
|
|
|
|
<button class="btn waves-effect waves-light red" type="submit" name="action" value="delete">
|
|
|
|
|
Account löschen
|
|
|
|
|
</button>
|
2019-03-18 17:55:39 +00:00
|
|
|
|
</div>
|
|
|
|
|
%= end
|
2019-03-12 20:49:26 +00:00
|
|
|
|
</div>
|
|
|
|
|
% }
|