2015-09-11 14:41:01 +05:30
%div
2022-08-27 11:52:29 +05:30
= render 'devise/shared/tab_single', tab_title: _('Two-Factor Authentication') if Feature.disabled?(:restyle_login_page, @project)
2022-07-16 23:28:13 +05:30
.login-box.gl-p-5
2015-09-11 14:41:01 +05:30
.login-body
2016-06-16 23:09:34 +05:30
- if @user.two_factor_otp_enabled?
2020-11-24 15:15:51 +05:30
= form_for(resource, as: resource_name, url: session_path(resource_name), method: :post, html: { class: "edit_user gl-show-field-errors js-2fa-form #{'hidden' if @user.two_factor_webauthn_u2f_enabled?}" }) do |f|
2016-06-16 23:09:34 +05:30
- resource_params = params[resource_name].presence || params
= f.hidden_field :remember_me, value: resource_params.fetch(:remember_me, 0)
2016-11-03 12:29:30 +05:30
%div
2022-08-27 11:52:29 +05:30
= f.label _('Two-Factor Authentication code'), name: :otp_attempt, class: Feature.enabled?(:restyle_login_page, @project) ? 'gl-mb-1' : ''
2021-04-29 21:17:54 +05:30
= f.text_field :otp_attempt, class: 'form-control gl-form-input', required: true, autofocus: true, autocomplete: 'off', title: _('This field is required.'), data: { qa_selector: 'two_fa_code_field' }
%p.form-text.text-muted.hint= _("Enter the code from the two-factor app on your mobile device. If you've lost your device, you may enter one of your recovery codes.")
2016-11-03 12:29:30 +05:30
.prepend-top-20
2021-04-29 21:17:54 +05:30
= f.submit _("Verify code"), class: "gl-button btn btn-confirm", data: { qa_selector: 'verify_code_button' }
2020-11-24 15:15:51 +05:30
- if @user.two_factor_webauthn_u2f_enabled?
= render "authentication/authenticate", params: params, resource: resource, resource_name: resource_name, render_remember_me: true, target_path: new_user_session_path