Skip to content
Snippets Groups Projects
Commit 04c14f97 authored by pabois's avatar pabois
Browse files

unlock from admin

parent b743d32a
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
end
def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up, keys: [:language_id, :first_name, :last_name, :picture, :picture_infos, :picture_delete])
devise_parameter_sanitizer.permit(:sign_up, keys: [:mobile_phone, :language_id, :first_name, :last_name, :picture, :picture_infos, :picture_delete])
end
def configure_account_update_params
......
<% if @user.max_login_attempts? %>
<div class="alert alert-danger">
This user account is currently <i>locked</i> due to too many MFA attempts.
<%= link_to 'Unlock it now!', unlock_admin_user_path(@user), method: :patch, class: 'alert-link' if can?(:update, @user) %>
<div class="alert-message">
<%= t('devise.two_factor_authentication.admin_locked_mfa_html') %>
<%= link_to t('devise.two_factor_authentication.admin_unlock'), unlock_admin_user_path(@user), method: :patch, class: 'alert-link' if can?(:update, @user) %>
</div>
</div>
<% end %>
<% if @user.access_locked? %>
<div class="alert alert-danger">
This user account is currently <i>locked</i>.
<% if [:time, :both].include?(Rails.configuration.devise.unlock_strategy) %>
<% distance = distance_of_time_in_words(@user.locked_at + Rails.configuration.devise.unlock_in - Time.now.utc) %>
<%= "It will unlock automatically in <i>#{distance}</i>.".html_safe %>
<% end %>
<%= link_to 'Unlock it now!', unlock_admin_user_path(@user), method: :patch, class: 'alert-link' if can?(:update, @user) %>
<div class="alert-message">
<%= t('devise.two_factor_authentication.admin_locked_html') %>
<% if [:time, :both].include?(Rails.configuration.devise.unlock_strategy) %>
<% distance = distance_of_time_in_words(@user.locked_at + Rails.configuration.devise.unlock_in - Time.now.utc) %>
<%= t('devise.two_factor_authentication.admin_unlock_in_html', distance: distance) %>
<% end %>
<%= link_to t('devise.two_factor_authentication.admin_unlock'), unlock_admin_user_path(@user), method: :patch, class: 'alert-link' if can?(:update, @user) %>
</div>
</div>
<% end %>
......@@ -39,6 +39,7 @@
allow_password_uncloaking: true,
compare_with_field: :password,
input_html: { autocomplete: "new-password" } %>
<%= f.input :mobile_phone %>
<%= f.input :picture,
as: :single_deletable_file,
input_html: { accept: '.jpg,.jpeg,.png' },
......
......@@ -52,6 +52,10 @@ en:
links:
sign_out: "Sign out"
two_factor_authentication:
admin_locked_html: This user account is currently <i>locked</i>.
admin_locked_mfa_html: This user account is currently <i>locked</i> due to too many MFA attempts.
admin_unlock_in_html: It will unlock automatically in <i>%{distance}</i>.
admin_unlock: Unlock it now!
attempt_failed: "Invalid Code"
code_has_been_sent: "Your authentication code has been sent."
enter_code_direct_otp: "Enter the code that was sent to you"
......
......@@ -52,6 +52,10 @@ fr:
links:
sign_out: "Se déconnecter"
two_factor_authentication:
admin_locked_html: Ce compte utilisateur est actuellement <i>verrouillé</i>.
admin_locked_mfa_html: Ce compte utilisateur est actuellement <i>verrouillé</i> à cause de tentatives de MFA excessives.
admin_unlock_in_html: Il se débloquera automatiquement dans <i>%{distance}</i>.
admin_unlock: Le débloquer !
attempt_failed: "Code invalide"
code_has_been_sent: "Un code d'authentification vient de vous être envoyé."
enter_code_direct_otp: "Entrez le code qui vous a été envoyé"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment