summaryrefslogtreecommitdiff
path: root/app/views/users/edit_login.html.erb
blob: c55ace769b60e2e63a39e673b565ae5db093cdc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<% title "Edit Login Credentials: #{@user.name}" %>

<%= link_to @user.name, @user %> → Edit Login settings
<h1>Edit Login Settings</h1>


<%= form_for @user, url: update_login_user_path(@user), method: :put do |f| %>
  <table>
    <tbody>
      <tr>
        <td>New email</td>
        <td>
          <%= f.text_field :email %>
        </td>
      </tr>
      <tr>
        <td>New password</td>
        <td>
          <%= f.password_field :password %>
        </td>
      </tr>
      <tr>
        <td>Repeat new password</td>
        <td>
          <%= f.password_field :password_confirmation %>
        </td>
      </tr>
    </tbody>
  </table>
  <hr>
  <table>
    <tbody>
      <tr>
        <td>2FA Enabled</td>
        <td>
          <%= f.check_box :totp_enabled %>
        </td>
      </tr>
      <tr>
        <td>TOTP Secret</td>
        <td>
          <% if !@user.totp_enabled? %>
          <%= f.text_field :totp_secret, :readonly => true %>
          <% else %>
          <i>2FA is currently enabled. Disable 2FA to generate a new secret.</i>
          <% end %>
        </td>
      </tr>
    </tbody>
  </table>
  <hr>
  <table>
    <tbody>
      <tr>
        <td>Current password</td>
        <td>
          <%= password_field_tag :current_password, nil, disabled: !@user.is?(current_user) %>
        </td>
      </tr>
      <% if !@user.totp_enabled? %>
      <tr>
        <td>TOTP Code</td>
        <td>
          <%= text_field_tag :totp_code, nil, disabled: !@user.is?(current_user) %>
        </td>
      </tr>
      <tr>
        <td></td>
        <td><i>Leave this field blank if you are not enabling 2FA.</i></td>
      <% end %>
    </tbody>
  </table>
  <p><%= f.submit "Save Changes", class: "btn blue left" %></p>
  <div class="clear"></div>
<% end %>