diff --git a/app/controllers/admin/whitelisted_verified_emails_controller.rb b/app/controllers/admin/whitelisted_verified_emails_controller.rb
new file mode 100644
index 000000000..e73804101
--- /dev/null
+++ b/app/controllers/admin/whitelisted_verified_emails_controller.rb
@@ -0,0 +1,5 @@
+class Admin::WhitelistedVerifiedEmailsController < AdminController
+ def index
+ @verified_emails = VerifiedEmail.where(status: 'whitelisted').order(created_at: :desc).page(params[:page]).per(50)
+ end
+end
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index e6d05f5e1..32d093b71 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -1,7 +1,11 @@
class AdminController < AuthenticatedUserController
before_action :check_user_is_admin!
- def index; end
+ layout 'admin'
+
+ def index
+ render layout: 'application'
+ end
def check_user_is_admin!
return if current_user.admin?
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb
index 5645591cc..ec083606d 100644
--- a/app/views/admin/index.html.erb
+++ b/app/views/admin/index.html.erb
@@ -12,6 +12,6 @@
<%= render partial: 'shared/alerts' %>
- - Hello
+ - <%= link_to 'Emails en liste blanche', admin_whitelisted_verified_emails_path %>
diff --git a/app/views/admin/whitelisted_verified_emails/index.html.erb b/app/views/admin/whitelisted_verified_emails/index.html.erb
new file mode 100644
index 000000000..97e9e0978
--- /dev/null
+++ b/app/views/admin/whitelisted_verified_emails/index.html.erb
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+ <%
+ %w[
+ email
+ created_at
+ actions
+ ].each do |attr|
+ %>
+
+ <%= t(".table.header.#{attr}") %>
+ |
+ <% end %>
+
+
+
+
+ <% @verified_emails.each do |verified_email| %>
+
+
+ <%= verified_email.email %>
+ |
+
+ <%= verified_email.created_at.to_date %>
+ |
+
+ Supprimer
+ |
+
+ <% end %>
+
+
+
+
+
+
+ <%= paginate @verified_emails %>
+
+
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb
new file mode 100644
index 000000000..d6b208c79
--- /dev/null
+++ b/app/views/layouts/admin.html.erb
@@ -0,0 +1,25 @@
+<%= content_for(:body) do %>
+
+
+
+ <%= render partial: 'shared/alerts' %>
+
+ <%= yield %>
+
+<% end %>
+
+<%= render template: 'layouts/application' %>
diff --git a/config/locales/admin.fr.yml b/config/locales/admin.fr.yml
index 35a12aa07..bcdf676da 100644
--- a/config/locales/admin.fr.yml
+++ b/config/locales/admin.fr.yml
@@ -2,3 +2,11 @@ fr:
admin:
index:
title: Espace administrateur
+ whitelisted_verified_emails:
+ index:
+ title: Emails en liste blanche
+ table:
+ header:
+ email: Email
+ created_at: Date de création
+ actions: Actions
diff --git a/config/routes.rb b/config/routes.rb
index cca11caef..91fb3b945 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -92,6 +92,10 @@
get '/admin', to: 'admin#index', as: :admin
+ namespace :admin do
+ resources :whitelisted_verified_emails, only: %w[index new create], path: 'emails-verifies'
+ end
+
namespace :api do
resources :frontal, only: :index
end
diff --git a/features/admin/emails_verifies.feature b/features/admin/emails_verifies.feature
new file mode 100644
index 000000000..080010dc5
--- /dev/null
+++ b/features/admin/emails_verifies.feature
@@ -0,0 +1,16 @@
+# language: fr
+
+Fonctionnalité: Espace admin: emails en liste blanche
+ En tant qu'administrateur, je peux voir les emails en liste blanche et en ajouter des supplémentaires,
+ dans le cas où on nous contacte au support et qu'on nous certifie que l'email est bien valide
+
+ Contexte:
+ Sachant que je suis un administrateur
+ Et que je me connecte
+
+ Scénario: Je peux consulter les emails en liste blanche
+ Quand il y a l'email "liste-blanche@gouv.fr" marqué en tant que "liste blanche"
+ Et qu'il y a l'email "delivrable@gouv.fr" marqué en tant que "délivrable"
+ Et que je me rends sur le module "Emails vérifiés" de l'espace administrateur
+ Alors la page contient "liste-blanche@gouv.fr"
+ Et la page ne contient pas "delivrable@gouv.fr"
diff --git a/features/step_definitions/admin_steps.rb b/features/step_definitions/admin_steps.rb
index 2773dd8ee..0271f9d2f 100644
--- a/features/step_definitions/admin_steps.rb
+++ b/features/step_definitions/admin_steps.rb
@@ -1,3 +1,7 @@
+Quand("je me rends sur le module {string} de l'espace administrateur") do |path|
+ visit "/admin/#{path.parameterize}"
+end
+
Quand("je vais sur l'espace administrateur") do
visit admin_path
end
diff --git a/features/step_definitions/whitelisted_verified_emails_steps.rb b/features/step_definitions/whitelisted_verified_emails_steps.rb
new file mode 100644
index 000000000..b2110b270
--- /dev/null
+++ b/features/step_definitions/whitelisted_verified_emails_steps.rb
@@ -0,0 +1,10 @@
+Quand("il y a l'email {string} marqué en tant que {string}") do |email, kind|
+ case kind
+ when 'délivrable'
+ status = 'deliverable'
+ when 'liste blanche'
+ status = 'whitelisted'
+ end
+
+ create(:verified_email, email:, status:)
+end