diff --git a/app/controllers/manager/users_controller.rb b/app/controllers/manager/users_controller.rb index effa7043c..287b2f20d 100644 --- a/app/controllers/manager/users_controller.rb +++ b/app/controllers/manager/users_controller.rb @@ -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 diff --git a/app/views/manager/users/show.html.erb b/app/views/manager/users/show.html.erb index 41f353302..ac1881a35 100644 --- a/app/views/manager/users/show.html.erb +++ b/app/views/manager/users/show.html.erb @@ -26,6 +26,14 @@ as well as a link to its edit page.
+ <% 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), diff --git a/config/routes.rb b/config/routes.rb index dbe1d200a..c4973d1ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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'