Commit cdb90deb authored by o@immerda.ch's avatar o@immerda.ch
Browse files

small ux changes

totp still needs to improve a lot...
parent 91d3d089
......@@ -10,49 +10,58 @@
<div class="qr-field"><%= raw(@qr.as_html) %></div>
</div>
</p>
<% end %>
<p>
<%= t :app_passwords_help %>
</p>
<% if @passwords && !@passwords.empty? %>
<ul>
<% @passwords.each do |pw, lastlogin| %>
<li>
<%= form_tag(app_passwords_path, method: "post") do %>
<%= pw %> (
<%- if lastlogin %>
<%= t(:last_used) %>: <%= lastlogin %>
<%- else %>
<%= t(:never_used) %>
<%- end %>)
<%= hidden_field_tag(:delete, '', value: pw) %>
&nbsp;<%= submit_tag(t :delete) %>
<% end %>
</li>
<% end %>
</ul>
<hr/ >
<% end %>
<br />
<%= form_tag(app_passwords_path, method: "post") do %>
<table>
<tr><td>
<%= label_tag(:app_name, (t :app_name)) %>
</td><td>
<%= text_field_tag(:app_name, '', value: t(:app_name), autocomplete: 'off') %>
</td></tr><tr><td>
<%= label_tag(:password, (t :your_main_pw)) %>
</td><td>
<%= password_field_tag(:password, nil, placeholder: t(:enter_your_current_pw)) %>
</td></tr>
</table>
<%= link_to t(:back), app_passwords_path %>
<% else %>
<p>
<%= t :app_passwords_help %>
</p>
<% if @passwords && !@passwords.empty? %>
<br />
<hr />
<ul>
<% @passwords.each do |pw, lastlogin| %>
<li>
<%= form_tag(app_passwords_path, method: "post") do %>
<%= pw %> (
<%- if lastlogin %>
<%= t(:last_used) %>: <%= lastlogin %>
<%- else %>
<%= t(:never_used) %>
<%- end %>)
<%= hidden_field_tag(:delete, '', value: pw) %>
&nbsp;<%= submit_tag(t :delete) %>
<% end %>
</li>
<% end %>
</ul>
<hr/ >
<% end %>
<br />
<p>
<%= submit_tag(t :generate) %>
<%= link_to t(:back), root_path %>
<b><%= t :new_app_passwords %>:</b>
</p>
<%= form_tag(app_passwords_path, method: "post") do %>
<table>
<tr><td>
<%= label_tag(:app_name, (t :app_name)) %>
</td><td>
<%= text_field_tag(:app_name, '', value: t(:app_name), autocomplete: 'off') %>
</td></tr><tr><td>
<%= label_tag(:password, (t :your_main_pw)) %>
</td><td>
<%= password_field_tag(:password, nil, placeholder: t(:enter_your_current_pw)) %>
</td></tr>
</table>
<p>
<%= submit_tag(t :generate) %>
<%= link_to t(:back), root_path %>
</p>
<% end %>
<% end %>
......@@ -2,40 +2,49 @@
<p>
<%= t(:status) %>: <%= @existing_totps.present? ? "<b>#{t(:activated)}</b>".html_safe : t(:disabled) %>
</p>
<p>
<%= t :tfa_enable_help %>
</p>
<h4><%= t(:totp_enable) %></h4>
<p>
<%= t :totp_enable_help %> <%= link_to 'FreeOTP', 'https://freeotp.github.io/', target: '_new' %>
</p>
<% if @totp_qr -%>
<%= render 'new_totp' %>
<% end -%>
<%= render 'new_totp' %>
<%= link_to t(:back), tfa_path %>
<% has_default = false
if @existing_totps.present? -%>
<h4><%= t(:existing_totps) %></h4>
<ul>
<% @existing_totps.each do |name, kind|
has_default = true if name == 'default'
-%>
<li> <%= name %> <%= link_to t(:delete), "/tfa/#{URI.encode(name)}/delete_totp", method: :post %></li>
<% else %>
<p>
<%= t :tfa_enable_help %>
</p>
<h4><%= t(:totp_enable) %></h4>
<p>
<%= t :totp_enable_help %> <%= link_to 'FreeOTP', 'https://freeotp.github.io/', target: '_new' %>
</p>
<% has_default = false
if @existing_totps.present? -%>
<hr />
<h4><%= t(:existing_totps) %></h4>
<ul>
<% @existing_totps.each do |name, kind|
has_default = true if name == 'default'
-%>
<li> <%= name %> <%= link_to t(:delete), "/tfa/#{URI.encode(name)}/delete_totp", method: :post %></li>
<% end -%>
</ul>
<% end -%>
</ul>
<% end -%>
<%= form_tag(tfa_path, method: "post") do %>
<table>
<tr><td>
<%= label_tag(:name, (t :name)) %>
</td><td>
<%= text_field_tag(:name, '', value: (has_default ? "default-#{Time.now.strftime("%Y%m%d%H%M")}" : 'default'), maxlength: 255, autocomplete: 'off') %>
</td></tr>
</table>
<%= hidden_field('', :kind, :value => 'totp') %>
<%= submit_tag(t(:create)) %>
<%= link_to t(:back), root_path %>
<% end %>
<hr />
<p>
<b> <%= t(:totp_enable) %>:</b>
</p>
<%= form_tag(tfa_path, method: "post") do %>
<table>
<tr><td>
<%= label_tag(:name, (t :name)) %>
</td><td>
<%= text_field_tag(:name, '', value: (has_default ? "default-#{Time.now.strftime("%Y%m%d%H%M")}" : 'default'), maxlength: 255, autocomplete: 'off') %>
</td></tr>
</table>
<%= hidden_field('', :kind, :value => 'totp') %>
<%= submit_tag(t(:create)) %>
<%= link_to t(:back), root_path %>
<% end %>
<% end -%>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment