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 ...@@ -31,7 +31,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
end end
def configure_sign_up_params 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 end
def configure_account_update_params def configure_account_update_params
......
<% if @user.max_login_attempts? %> <% if @user.max_login_attempts? %>
<div class="alert alert-danger"> <div class="alert alert-danger">
This user account is currently <i>locked</i> due to too many MFA attempts. <div class="alert-message">
<%= link_to 'Unlock it now!', unlock_admin_user_path(@user), method: :patch, class: 'alert-link' if can?(:update, @user) %> <%= 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> </div>
<% end %> <% end %>
<% if @user.access_locked? %> <% if @user.access_locked? %>
<div class="alert alert-danger"> <div class="alert alert-danger">
This user account is currently <i>locked</i>. <div class="alert-message">
<% if [:time, :both].include?(Rails.configuration.devise.unlock_strategy) %> <%= t('devise.two_factor_authentication.admin_locked_html') %>
<% distance = distance_of_time_in_words(@user.locked_at + Rails.configuration.devise.unlock_in - Time.now.utc) %> <% if [:time, :both].include?(Rails.configuration.devise.unlock_strategy) %>
<%= "It will unlock automatically in <i>#{distance}</i>.".html_safe %> <% distance = distance_of_time_in_words(@user.locked_at + Rails.configuration.devise.unlock_in - Time.now.utc) %>
<% end %> <%= t('devise.two_factor_authentication.admin_unlock_in_html', distance: distance) %>
<%= link_to 'Unlock it now!', unlock_admin_user_path(@user), method: :patch, class: 'alert-link' if can?(:update, @user) %> <% 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> </div>
<% end %> <% end %>
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
allow_password_uncloaking: true, allow_password_uncloaking: true,
compare_with_field: :password, compare_with_field: :password,
input_html: { autocomplete: "new-password" } %> input_html: { autocomplete: "new-password" } %>
<%= f.input :mobile_phone %>
<%= f.input :picture, <%= f.input :picture,
as: :single_deletable_file, as: :single_deletable_file,
input_html: { accept: '.jpg,.jpeg,.png' }, input_html: { accept: '.jpg,.jpeg,.png' },
......
...@@ -52,6 +52,10 @@ en: ...@@ -52,6 +52,10 @@ en:
links: links:
sign_out: "Sign out" sign_out: "Sign out"
two_factor_authentication: 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" attempt_failed: "Invalid Code"
code_has_been_sent: "Your authentication code has been sent." code_has_been_sent: "Your authentication code has been sent."
enter_code_direct_otp: "Enter the code that was sent to you" enter_code_direct_otp: "Enter the code that was sent to you"
......
...@@ -52,6 +52,10 @@ fr: ...@@ -52,6 +52,10 @@ fr:
links: links:
sign_out: "Se déconnecter" sign_out: "Se déconnecter"
two_factor_authentication: 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" attempt_failed: "Code invalide"
code_has_been_sent: "Un code d'authentification vient de vous être envoyé." 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é" 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