Skip to content

Commit

Permalink
Add enabled/disabled pills for OTP & Webauthn
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Herscovich <eric.herscovich@shopify.com>
  • Loading branch information
george-ma and ericherscovich committed Jul 14, 2023
1 parent 203540d commit 4d7d1d6
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 17 deletions.
21 changes: 21 additions & 0 deletions app/assets/stylesheets/modules/mfa.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,24 @@
gap: 1rem;
}
}

.mfa__header {
display: inline-block;
padding-top: 0px !important;
}

.pill {
margin-bottom: 20px;
margin-left: 10px;
width: 10%;
max-width: 320px;
background-color: #e9573f;
color: #ffffff;
transition-duration: 0.25s;
transition-property: opacity;
border-radius: 20px;
padding: 10px;
text-align: center;
font-weight: 600;
display: inline-block;
}
18 changes: 10 additions & 8 deletions app/views/settings/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="t-body">
<h2 class="page__subheading"><%= t ".mfa.multifactor_auth" %></h2>
<% if @user.mfa_enabled? %>
<h2><%= t(".mfa.level.title")%></h2>
<h2 class="mfa__header"><%= t(".mfa.level.title")%></h2>
<p><%= t(".mfa.level_html") %></p>

<%= form_tag multifactor_auth_path, method: :put, id: "mfa-edit" do %>
Expand All @@ -13,9 +13,10 @@
<% end %>
<% end %>
<h2><%= t(".mfa.otp")%></h2>
<% if @user.totp_enabled? %>
<p><%= t(".mfa.enabled") %></p>
<h2 class="mfa__header"><%= t(".mfa.otp")%></h2>
<div class="pill"> <%= t(".mfa.enabled") %> </div>
<p><%= t(".mfa.enabled_note") %></p>
<%= form_tag multifactor_auth_path, method: :delete, id: "mfa-delete" do %>
<div class="text_field">
<%= label_tag :otp, t(".otp_code"), class: "form__label" %>
Expand All @@ -24,15 +25,16 @@
<%= submit_tag t(".mfa.disable"), class: "form__submit" %>
<% end %>
<% else %>
<div class="t-body">
<p>
<h2 class="mfa__header"><%= t(".mfa.otp")%></h2>
<div class="pill"> <%= t(".mfa.disabled") %> </div>
<p>
<%= t(".mfa.disabled_html") %>
<%= button_to t(".mfa.go_settings"), new_multifactor_auth_path, method: "get", class: "form__submit" %>
</p>
</div>
</p>
<% end %>

<h2><%= t(".webauthn_credentials") %></h2>
<h2 class="mfa__header"><%= t(".webauthn_credentials") %></h2>
<div class="pill"> <%= @user.webauthn_enabled? ? t(".mfa.enabled") : t(".mfa.disabled") %> </div>

<p><%= t(".webauthn_credential_note")%></p>

Expand Down
4 changes: 3 additions & 1 deletion config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,11 @@ de:
disabled_html:
go_settings:
level_html:
enabled:
enabled_note:
update:
disable:
enabled:
disabled:
level:
title:
disabled:
Expand Down
4 changes: 3 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,12 @@ en:
disabled_html: You have not yet enabled OTP based multi-factor authentication. Please refer to <a target="_blank" href="https://guides.rubygems.org/setting-up-multifactor-authentication">RubyGems MFA guide</a> for more information on MFA levels.
go_settings: Register a new device
level_html: You have enabled multi-factor authentication. Please click 'Update' to change your MFA level. Please refer to <a target="_blank" href="https://guides.rubygems.org/setting-up-multifactor-authentication">RubyGems MFA guide</a> for more information on MFA levels.
enabled: You have enabled multi-factor authentication. Please input your OTP from your authenticator or one of your active
enabled_note: You have enabled multi-factor authentication. Please input your OTP from your authenticator or one of your active
recovery codes to disable it.
update: Update
disable: Disable
enabled: Enabled
disabled: Disabled
level:
title: MFA Level
disabled: Disabled
Expand Down
4 changes: 3 additions & 1 deletion config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,11 @@ es:
disabled_html:
go_settings: Registrar un nuevo dispositivo
level_html:
enabled:
enabled_note:
update: Actualizar
disable:
enabled:
disabled:
level:
title: Nivel de Autenticación de Múltiples Factores
disabled: Desactivada
Expand Down
4 changes: 3 additions & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,11 @@ fr:
disabled_html:
go_settings: Enregistrer un nouvel appareil
level_html:
enabled:
enabled_note:
update:
disable:
enabled:
disabled:
level:
title:
disabled:
Expand Down
4 changes: 3 additions & 1 deletion config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,11 @@ ja:
disabled_html:
go_settings:
level_html:
enabled:
enabled_note:
update:
disable:
enabled:
disabled:
level:
title:
disabled:
Expand Down
4 changes: 3 additions & 1 deletion config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,11 @@ nl:
disabled_html:
go_settings:
level_html:
enabled:
enabled_note:
update:
disable:
enabled:
disabled:
level:
title:
disabled:
Expand Down
4 changes: 3 additions & 1 deletion config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,11 @@ pt-BR:
disabled_html:
go_settings:
level_html:
enabled:
enabled_note:
update:
disable:
enabled:
disabled:
level:
title:
disabled:
Expand Down
4 changes: 3 additions & 1 deletion config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,11 @@ zh-CN:
disabled_html:
go_settings: 注册新装置
level_html:
enabled:
enabled_note:
update: 更新
disable:
enabled:
disabled:
level:
title: 多重验证等级
disabled: 停用
Expand Down
4 changes: 3 additions & 1 deletion config/locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,11 @@ zh-TW:
disabled_html:
go_settings: 註冊新裝置
level_html:
enabled:
enabled_note:
update: 更新
disable:
enabled:
disabled:
level:
title: 多重驗證等級
disabled: 停用
Expand Down

0 comments on commit 4d7d1d6

Please sign in to comment.