diff options
Diffstat (limited to 'app/views/profiles/two_factor_auths/show.html.haml')
-rw-r--r-- | app/views/profiles/two_factor_auths/show.html.haml | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/app/views/profiles/two_factor_auths/show.html.haml b/app/views/profiles/two_factor_auths/show.html.haml index bce43b16d27..82265938180 100644 --- a/app/views/profiles/two_factor_auths/show.html.haml +++ b/app/views/profiles/two_factor_auths/show.html.haml @@ -1,6 +1,7 @@ - page_title _('Two-Factor Authentication'), _('Account') - add_to_breadcrumbs(_('Two-Factor Authentication'), profile_account_path) - @content_class = "limit-container-width" unless fluid_layout +- webauthn_enabled = Feature.enabled?(:webauthn) .js-two-factor-auth{ 'data-two-factor-skippable' => "#{two_factor_skippable?}", 'data-two_factor_skip_url' => skip_profile_two_factor_auth_path } .row.gl-mt-3 @@ -18,7 +19,7 @@ %div = link_to _('Disable two-factor authentication'), profile_two_factor_auth_path, method: :delete, - data: { confirm: _('Are you sure? This will invalidate your registered applications and U2F devices.') }, + data: { confirm: webauthn_enabled ? _('Are you sure? This will invalidate your registered applications and U2F / WebAuthn devices.') : _('Are you sure? This will invalidate your registered applications and U2F devices.') }, class: 'btn btn-danger gl-mr-3' = form_tag codes_profile_two_factor_auth_path, {style: 'display: inline-block', method: :post} do |f| = submit_tag _('Regenerate recovery codes'), class: 'btn' @@ -45,7 +46,7 @@ = _('Time based: Yes') = form_tag profile_two_factor_auth_path, method: :post do |f| - if @error - .alert.alert-danger + .gl-alert.gl-alert-danger.gl-mb-5 = @error .form-group = label_tag :pin_code, _('Pin code'), class: "label-bold" @@ -58,22 +59,35 @@ .row.gl-mt-3 .col-lg-4 %h4.gl-mt-0 - = _('Register Universal Two-Factor (U2F) Device') + - if webauthn_enabled + = _('Register WebAuthn Device') + - else + = _('Register Universal Two-Factor (U2F) Device') %p = _('Use a hardware device to add the second factor of authentication.') %p - = _("As U2F devices are only supported by a few browsers, we require that you set up a two-factor authentication app before a U2F device. That way you'll always be able to log in - even when you're using an unsupported browser.") + - if webauthn_enabled + = _("As WebAuthn devices are only supported by a few browsers, we require that you set up a two-factor authentication app before a WebAuthn device. That way you'll always be able to log in - even when you're using an unsupported browser.") + - else + = _("As U2F devices are only supported by a few browsers, we require that you set up a two-factor authentication app before a U2F device. That way you'll always be able to log in - even when you're using an unsupported browser.") .col-lg-8 - - if @u2f_registration.errors.present? - = form_errors(@u2f_registration) - = render "u2f/register" + - registration = webauthn_enabled ? @webauthn_registration : @u2f_registration + - if registration.errors.present? + = form_errors(registration) + - if webauthn_enabled + = render "authentication/register", target_path: create_webauthn_profile_two_factor_auth_path + - else + = render "authentication/register", target_path: create_u2f_profile_two_factor_auth_path %hr %h5 - = _('U2F Devices (%{length})') % { length: @u2f_registrations.length } + - if webauthn_enabled + = _('WebAuthn Devices (%{length})') % { length: @registrations.length } + - else + = _('U2F Devices (%{length})') % { length: @registrations.length } - - if @u2f_registrations.present? + - if @registrations.present? .table-responsive %table.table.table-bordered.u2f-registrations %colgroup @@ -86,12 +100,15 @@ %th= s_('2FADevice|Registered On') %th %tbody - - @u2f_registrations.each do |registration| + - @registrations.each do |registration| %tr - %td= registration.name.presence || html_escape_once(_("<no name set>")).html_safe - %td= registration.created_at.to_date.to_s(:medium) - %td= link_to _('Delete'), profile_u2f_registration_path(registration), method: :delete, class: "btn btn-danger float-right", data: { confirm: _('Are you sure you want to delete this device? This action cannot be undone.') } + %td= registration[:name].presence || html_escape_once(_("<no name set>")).html_safe + %td= registration[:created_at].to_date.to_s(:medium) + %td= link_to _('Delete'), registration[:delete_path], method: :delete, class: "btn btn-danger float-right", data: { confirm: _('Are you sure you want to delete this device? This action cannot be undone.') } - else .settings-message.text-center - = _("You don't have any U2F devices registered yet.") + - if webauthn_enabled + = _("You don't have any WebAuthn devices registered yet.") + - else + = _("You don't have any U2F devices registered yet.") |