show.html.erb 2.02 KB
Newer Older
1
2
<h3><%= @page_title = t(:app_passwords) %></h3>

o@immerda.ch's avatar
o@immerda.ch committed
3
4
<% if @app_pw %>
  <b> <%= t(:your_app_pw_is) %> </b>
o@immerda.ch's avatar
o@immerda.ch committed
5
  <p>
o@immerda.ch's avatar
o@immerda.ch committed
6
  <div class="password-readable"><%= @app_pw %></div>
o@immerda.ch's avatar
o@immerda.ch committed
7
  <br />
o@immerda.ch's avatar
o@immerda.ch committed
8
9
  <b><a href="#" id="qr-toggle"><%= t(:qr_code) %></a></b>
  <div id="qr-hidden">
o@immerda.ch's avatar
o@immerda.ch committed
10
  <div class="qr-field"><%= raw(@qr.as_html) %></div>
o@immerda.ch's avatar
o@immerda.ch committed
11
  </div>
o@immerda.ch's avatar
o@immerda.ch committed
12
  </p>
o@immerda.ch's avatar
o@immerda.ch committed
13

o@immerda.ch's avatar
o@immerda.ch committed
14
15
16
  <%= link_to t(:back), app_passwords_path %>
<% else %>

17
<div class="alert alert-info" role="alert">
mh's avatar
mh committed
18
  <%= t(:app_passwords_help) %>
19
</div>
o@immerda.ch's avatar
o@immerda.ch committed
20

mh's avatar
mh committed
21
  <% if @passwords.present? %>
22
23
24
25
26
27
28
29
30
    <table class="table table-hover">
      <thead>
        <tr class="border">
          <th scope="col"><%= t(:app_name) %></th>
          <th scope="col"><%= t(:last_used) %></th>
          <th scope="col"></th>
        </tr>
      </thead>
      <tbody>
o@immerda.ch's avatar
o@immerda.ch committed
31
      <% @passwords.each do |pw, lastlogin| %>
32
33
34
35
36
37
38
        <tr class="border">
          <td class="align-middle"><%= pw %></td>
          <td class="align-middle"><%- if lastlogin %><%= t(:last_used) %>: <%= lastlogin %><%- else %><%= t(:never_used) %><%- end %></td>
          <td><%= form_tag(app_passwords_path, method: "post") do %><%= hidden_field_tag(:delete, '', value: pw) %><%= submit_tag(t(:delete), class: "btn btn-danger") %><% end %></td>
        </tr>
      <% end %>
      </tbody>
o@immerda.ch's avatar
o@immerda.ch committed
39
40
    </table>
  <% end %>
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

  <div class="card">
    <div class="card-body">
      <h5 class="card-title"><%= t(:new_app_passwords) %></h5>
        <%= form_tag(app_passwords_path, method: "post") do %>
          <div class="row mb-2">
            <div class="col">
              <%= label_tag(:app_name, t(:app_name)) %>
              <%= text_field_tag(:app_name, '', value: t(:app_name), autocomplete: 'off', class: "form-control") %>
            </div>
            <div class="col">
              <%= label_tag(:password, t(:your_main_pw)) %>
              <%= password_field_tag(:password, nil, placeholder: t(:enter_your_current_pw), class: "form-control") %>
            </div>
          </div>
          <%= submit_tag(t(:generate), class: "btn btn-primary") %>
        <% end %>
    </div>
  </div>
o@immerda.ch's avatar
o@immerda.ch committed
60
<% end %>