summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/account/twofa_confirm.html.erb20
-rw-r--r--app/views/my/_sidebar.html.erb2
-rw-r--r--app/views/my/account.html.erb11
-rw-r--r--app/views/twofa/activate_confirm.html.erb27
-rw-r--r--app/views/twofa/deactivate_confirm.html.erb25
-rw-r--r--app/views/twofa/totp/_new.html.erb8
-rw-r--r--app/views/users/_form.html.erb13
7 files changed, 105 insertions, 1 deletions
diff --git a/app/views/account/twofa_confirm.html.erb b/app/views/account/twofa_confirm.html.erb
new file mode 100644
index 000000000..5cf3b3dda
--- /dev/null
+++ b/app/views/account/twofa_confirm.html.erb
@@ -0,0 +1,20 @@
+<div id="login-form">
+
+ <h3><%=l :setting_twofa %></h3>
+ <p><%=l 'twofa_label_enter_otp' %></p>
+
+ <%= form_tag({ action: 'twofa' },
+ { id: 'twofa_form',
+ onsubmit: 'return keepAnchorOnSignIn(this);' }) do -%>
+
+
+ <label for="twofa_code">
+ <%=l 'twofa_label_code' -%>
+ <%= link_to l('twofa_resend_code'), { controller: 'account', action: 'twofa_resend' }, method: :post, class: 'lost_password' if @twofa_view[:resendable] -%>
+ </label>
+ <%= text_field_tag :twofa_code, nil, tabindex: '1', autocomplete: 'off', autofocus: true -%>
+
+ <%= submit_tag l(:button_login), tabindex: '2', id: 'login-submit', name: :submit_otp -%>
+ <% end %>
+
+</div>
diff --git a/app/views/my/_sidebar.html.erb b/app/views/my/_sidebar.html.erb
index e372425aa..e962538b5 100644
--- a/app/views/my/_sidebar.html.erb
+++ b/app/views/my/_sidebar.html.erb
@@ -4,7 +4,7 @@
<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %></p>
<% if @user.own_account_deletable? %>
- <p><%= link_to(l(:button_delete_my_account), {:action => 'destroy'}, :class => 'icon icon-del') %></p>
+ <p><%= link_to(l(:button_delete_my_account), {:controller => 'my', :action => 'destroy'}, :class => 'icon icon-del') %></p>
<% end %>
<h4><%= l(:label_feeds_access_key) %></h4>
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index 87b2d7cbd..da7746bb2 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -28,6 +28,17 @@
<% if Setting.openid? %>
<p><%= f.text_field :identity_url %></p>
<% end %>
+ <p>
+ <label><%=l :setting_twofa -%></label>
+ <% if @user.twofa_active? %>
+ <%=l 'twofa_currently_active', twofa_scheme_name: l("twofa__#{@user.twofa_scheme}__name") -%><br/>
+ <%= link_to l('button_disable'), { controller: 'twofa', action: 'deactivate_init', scheme: @user.twofa_scheme }, method: :post -%><br/>
+ <% else %>
+ <% Redmine::Twofa.available_schemes.each do |s| %>
+ <%= link_to l("twofa__#{s}__label_activate"), { controller: 'twofa', action: 'activate_init', scheme: s }, method: :post -%><br/>
+ <% end %>
+ <% end %>
+ </p>
<% @user.custom_field_values.select(&:editable?).each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
diff --git a/app/views/twofa/activate_confirm.html.erb b/app/views/twofa/activate_confirm.html.erb
new file mode 100644
index 000000000..fc356323c
--- /dev/null
+++ b/app/views/twofa/activate_confirm.html.erb
@@ -0,0 +1,27 @@
+<h2><%=l 'twofa_label_setup' -%></h2>
+
+<div class="splitcontentleft">
+ <%= form_tag({ action: :activate,
+ scheme: @twofa_view[:scheme_name] },
+ { method: :post,
+ id: 'twofa_form' }) do -%>
+
+ <div class="box">
+ <p><%=t "twofa__#{@twofa_view[:scheme_name]}__text_pairing_info_html" -%></p>
+ <div class="tabular">
+ <%= render partial: "twofa/#{@twofa_view[:scheme_name]}/new", locals: { twofa_view: @twofa_view } -%>
+ <p>
+ <label for="twofa_code"><%=l 'twofa_label_code' -%></label>
+ <%= text_field_tag :twofa_code, nil, autocomplete: 'off', autofocus: true -%>
+ </p>
+ </div>
+ </div>
+
+ <%= submit_tag l('button_activate'), name: :submit_otp -%>
+ <%= link_to l('twofa_resend_code'), { action: 'activate_init', scheme: @twofa_view[:scheme_name] }, method: :post if @twofa_view[:resendable] -%>
+ <% end %>
+</div>
+
+<% content_for :sidebar do %>
+<%= render :partial => 'my/sidebar' %>
+<% end %>
diff --git a/app/views/twofa/deactivate_confirm.html.erb b/app/views/twofa/deactivate_confirm.html.erb
new file mode 100644
index 000000000..f2ecb0d07
--- /dev/null
+++ b/app/views/twofa/deactivate_confirm.html.erb
@@ -0,0 +1,25 @@
+<h2><%=l 'twofa_label_deactivation_confirmation' -%></h2>
+
+<div class="splitcontentleft">
+ <%= form_tag({ action: :deactivate,
+ scheme: @twofa_view[:scheme_name] },
+ { method: :post,
+ id: 'twofa_form' }) do -%>
+ <div class="box">
+
+ <p><%=l 'twofa_label_enter_otp' %></p>
+ <div class="tabular">
+ <p>
+ <label for="twofa_code"><%=l 'twofa_label_code' -%></label>
+ <%= text_field_tag :twofa_code, nil, autocomplete: 'off' -%>
+ </p>
+ </div>
+ </div>
+ <%= submit_tag l('button_disable'), name: :submit_otp -%>
+ <%= link_to l('twofa_resend_code'), { action: 'deactivate_init', scheme: @twofa_view[:scheme_name] }, method: :post if @twofa_view[:resendable] -%>
+ <% end %>
+</div>
+
+<% content_for :sidebar do %>
+<%= render :partial => 'my/sidebar' %>
+<% end %>
diff --git a/app/views/twofa/totp/_new.html.erb b/app/views/twofa/totp/_new.html.erb
new file mode 100644
index 000000000..c1f4375f2
--- /dev/null
+++ b/app/views/twofa/totp/_new.html.erb
@@ -0,0 +1,8 @@
+<p>
+ <label>&nbsp;</label>
+ <%= image_tag RQRCode::QRCode.new(twofa_view[:provisioning_uri]).as_png(fill: ChunkyPNG::Color::TRANSPARENT, resize_exactly_to: 280, border_modules: 0).to_data_url, id: 'twofa_code' -%>
+</p>
+<p>
+ <label><%=l 'twofa__totp__label_plain_text_key' -%></label>
+ <code><%= twofa_view[:totp_key].scan(/.{4}/).join(' ') -%></code>
+</p>
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index bb20a4f9d..b9054a3b0 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -42,6 +42,19 @@
<p><%= f.check_box :generate_password %></p>
<p><%= f.check_box :must_change_passwd %></p>
</div>
+ <p>
+ <label><%=l :setting_twofa -%></label>
+ <% if @user.twofa_active? %>
+ <%=l 'twofa_currently_active', twofa_scheme_name: l("twofa__#{@user.twofa_scheme}__name") -%><br/>
+ <% if @user == User.current # administrators cannot deactivate their own 2FA without confirmation code %>
+ <%= link_to l('button_disable'), { controller: 'twofa', action: 'deactivate_init', scheme: @user.twofa_scheme }, method: :post -%>
+ <% else %>
+ <%= link_to l('button_disable'), { controller: 'twofa', action: 'admin_deactivate', user_id: @user }, method: :post -%>
+ <% end %>
+ <% else %>
+ <%=l 'twofa_not_active' %>
+ <% end %>
+ </p>
</fieldset>
</div>