Feat(SuperAdmin): super admin can unblock email

This commit is contained in:
simon lehericey 2024-05-31 16:30:22 +02:00
parent 3eafc6bfdc
commit 72f7c1d632
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
3 changed files with 16 additions and 0 deletions

View file

@ -23,6 +23,13 @@ module Manager
end end
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 def resend_confirmation_instructions
user = User.find(params[:id]) user = User.find(params[:id])
user.resend_confirmation_instructions user.resend_confirmation_instructions

View file

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

View file

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