Merge pull request #10481 from demarches-simplifiees/super_admin_can_unblock_email

ETQ SuperAdmin, je peux débloquer les emails d'un usager
This commit is contained in:
LeSim 2024-06-03 09:58:48 +00:00 committed by GitHub
commit 57e9cccbbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View file

@ -23,6 +23,13 @@ module Manager
end
end
def unblock_mails
user = User.find(params[:id])
user.update!(email_verified_at: Time.current)
flash[:notice] = "Les emails ont été débloqués."
redirect_to manager_user_path(user)
end
def resend_confirmation_instructions
user = User.find(params[:id])
user.resend_confirmation_instructions

View file

@ -26,6 +26,14 @@ as well as a link to its edit page.
</h1>
<div class="buttons">
<% if user.unverified_email? %>
<%= link_to(
"Débloquer mails",
[:unblock_mails, namespace, page.resource],
method: :post,
class: "button") %>
<% end %>
<%= link_to(
"Modifier",
edit_manager_user_path(page.resource),

View file

@ -50,6 +50,7 @@ Rails.application.routes.draw do
delete 'delete', on: :member
post 'resend_confirmation_instructions', on: :member
post 'resend_reset_password_instructions', on: :member
post 'unblock_mails', on: :member
put 'enable_feature', on: :member
get 'emails', on: :member
put 'unblock_email'