diff --git a/app/controllers/admin/communication/extranets_controller.rb b/app/controllers/admin/communication/extranets_controller.rb
index 56a12f99240789ea9688ba540febe057a20fe96b..0ce706a8148be3983a8319a5943dd0dc7cee14ed 100644
--- a/app/controllers/admin/communication/extranets_controller.rb
+++ b/app/controllers/admin/communication/extranets_controller.rb
@@ -64,7 +64,7 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat
 
   def extranet_params
     params.require(:communication_extranet)
-          .permit(:name, :domain, :about_type, :about_id,
+          .permit(:name, :host, :about_type, :about_id,
             :registration_contact, :logo, :logo_delete,
             :has_sso, :sso_inherit_from_university, :sso_target_url, :sso_cert, :sso_name_identifier_format, :sso_mapping
           )
diff --git a/app/controllers/concerns/users/add_context_to_request_params.rb b/app/controllers/concerns/users/add_context_to_request_params.rb
new file mode 100644
index 0000000000000000000000000000000000000000..d0e8c900c69fe667267c4294e0b712e475caf14d
--- /dev/null
+++ b/app/controllers/concerns/users/add_context_to_request_params.rb
@@ -0,0 +1,16 @@
+module Users::AddContextToRequestParams
+  extend ActiveSupport::Concern
+
+  included do
+    prepend_before_action :add_context_to_request_params, only: :create
+  end
+
+  protected
+
+  def add_context_to_request_params
+    # inject university_id & context in users params submitted
+    return if request.params[:user].nil?
+    request.params[:user][:university_id] = current_university.id
+    request.params[:user][:registration_context] = current_context
+  end
+end
diff --git a/app/controllers/concerns/users/add_university_to_request_params.rb b/app/controllers/concerns/users/add_university_to_request_params.rb
deleted file mode 100644
index 754392681d38ae197ed068460453d0ebe18cdfb1..0000000000000000000000000000000000000000
--- a/app/controllers/concerns/users/add_university_to_request_params.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Users::AddUniversityToRequestParams
-  extend ActiveSupport::Concern
-
-  included do
-    prepend_before_action :add_university_to_request_params, only: :create
-  end
-
-  protected
-
-  def add_university_to_request_params
-    # inject university_id in users params submitted
-    request.params[:user][:university_id] = current_university.id unless request.params[:user].nil?
-  end
-end
diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb
index 2d4b6116e699ad6392c763d02a0dd175d1ce54ef..14962a300afaa6588b7bf148b6de12dbb42d606f 100644
--- a/app/controllers/users/confirmations_controller.rb
+++ b/app/controllers/users/confirmations_controller.rb
@@ -1,5 +1,5 @@
 class Users::ConfirmationsController < Devise::ConfirmationsController
-  include Users::AddUniversityToRequestParams
+  include Users::AddContextToRequestParams
   include Users::LayoutChoice
 
   def resend
diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb
index 49d967b4a033355dbcca5e64e6d9e93d1854a1fe..4902f4ed6f10f03a06da97d58afa0892881285b1 100644
--- a/app/controllers/users/passwords_controller.rb
+++ b/app/controllers/users/passwords_controller.rb
@@ -1,5 +1,5 @@
 class Users::PasswordsController < Devise::PasswordsController
-  include Users::AddUniversityToRequestParams
+  include Users::AddContextToRequestParams
   include Users::LayoutChoice
 
   def update
diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb
index 8df0d601806a323ed5d862d8e2d6321379e0bcb1..840ef1be6bb094550c6e00122b175a415351ae1b 100644
--- a/app/controllers/users/registrations_controller.rb
+++ b/app/controllers/users/registrations_controller.rb
@@ -1,5 +1,5 @@
 class Users::RegistrationsController < Devise::RegistrationsController
-  include Users::AddUniversityToRequestParams
+  include Users::AddContextToRequestParams
   include Users::LayoutChoice
 
   before_action :configure_sign_up_params, only: :create
diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb
index 41758961c657e1597c9287762fd454a5ac52e91e..166de839e8614df6823045fa6e804f9d0f628170 100644
--- a/app/controllers/users/sessions_controller.rb
+++ b/app/controllers/users/sessions_controller.rb
@@ -1,5 +1,5 @@
 class Users::SessionsController < Devise::SessionsController
-  include Users::AddUniversityToRequestParams
+  include Users::AddContextToRequestParams
   include Users::LayoutChoice
 
   # DELETE /resource/sign_out
diff --git a/app/controllers/users/unlocks_controller.rb b/app/controllers/users/unlocks_controller.rb
index 47d30a6a53e2c1696cfb166427bc8ec8764a7b14..001af98ef133c8bf2baf7cd7c6b05baa6a5d26d0 100644
--- a/app/controllers/users/unlocks_controller.rb
+++ b/app/controllers/users/unlocks_controller.rb
@@ -1,4 +1,4 @@
 class Users::UnlocksController < Devise::UnlocksController
-  include Users::AddUniversityToRequestParams
+  include Users::AddContextToRequestParams
   include Users::LayoutChoice
 end
diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb
index 430eee58f6549df45103cc1bf97e6818bc454ecb..5796201ee95635b30c454735bf5d47989112143c 100644
--- a/app/mailers/devise_mailer.rb
+++ b/app/mailers/devise_mailer.rb
@@ -4,6 +4,7 @@ class DeviseMailer < Devise::Mailer
   default template_path: 'devise/mailer' # to make sure that your mailer uses the devise views
 
   def confirmation_instructions(record, token, opts={})
+    @record = record
     opts = merge_with_university_infos(record.university, opts)
     I18n.with_locale(record.language.iso_code.to_sym) do
       super
@@ -11,6 +12,7 @@ class DeviseMailer < Devise::Mailer
   end
 
   def reset_password_instructions(record, token, opts={})
+    @record = record
     opts = merge_with_university_infos(record.university, opts)
     I18n.with_locale(record.language.iso_code.to_sym) do
       super
@@ -18,6 +20,7 @@ class DeviseMailer < Devise::Mailer
   end
 
   def unlock_instructions(record, token, opts={})
+    @record = record
     opts = merge_with_university_infos(record.university, opts)
     I18n.with_locale(record.language.iso_code.to_sym) do
       super
@@ -25,6 +28,7 @@ class DeviseMailer < Devise::Mailer
   end
 
   def email_changed(record, opts={})
+    @record = record
     opts = merge_with_university_infos(record.university, opts)
     I18n.with_locale(record.language.iso_code.to_sym) do
       super
@@ -32,6 +36,7 @@ class DeviseMailer < Devise::Mailer
   end
 
   def password_change(record, opts={})
+    @record = record
     opts = merge_with_university_infos(record.university, opts)
     I18n.with_locale(record.language.iso_code.to_sym) do
       super
@@ -39,6 +44,7 @@ class DeviseMailer < Devise::Mailer
   end
 
   def two_factor_authentication_code(record, code, opts = {})
+    @record = record
     opts = merge_with_university_infos(record.university, opts)
     @code = code
     @duration =  ActiveSupport::Duration.build(Rails.application.config.devise.direct_otp_valid_for).inspect
@@ -49,7 +55,7 @@ class DeviseMailer < Devise::Mailer
 
   def default_url_options
     {
-      host: @university.host,
+      host: @record.registration_context.present? ? @record.registration_context.host : @university.host,
       port: Rails.env.development? ? 3000 : nil
     }
   end
diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb
index a560c39170289f3b547927e8db613d5babffa86a..5603cbe42936c6056f2741b7aa47ccc1daba3534 100644
--- a/app/models/communication/extranet.rb
+++ b/app/models/communication/extranet.rb
@@ -4,8 +4,8 @@
 #
 #  id                          :uuid             not null, primary key
 #  about_type                  :string           indexed => [about_id]
-#  domain                      :string
 #  has_sso                     :boolean          default(FALSE)
+#  host                        :string
 #  name                        :string
 #  registration_contact        :string
 #  sso_cert                    :text
@@ -33,20 +33,20 @@ class Communication::Extranet < ApplicationRecord
   include WithSso
   include WithUniversity
 
-  validates_presence_of :name, :domain
+  validates_presence_of :name, :host
 
   has_one_attached_deletable :logo
 
   scope :ordered, -> { order(:name) }
   scope :for_search_term, -> (term) {
     where("
-      unaccent(communication_extranets.domain) ILIKE unaccent(:term) OR
+      unaccent(communication_extranets.host) ILIKE unaccent(:term) OR
       unaccent(communication_extranets.name) ILIKE unaccent(:term)
     ", term: "%#{sanitize_sql_like(term)}%")
   }
 
   def self.with_host(host)
-    find_by domain: host
+    find_by host: host
   end
 
   def should_show_years?
@@ -73,7 +73,7 @@ class Communication::Extranet < ApplicationRecord
   end
 
   def url
-    "https://#{domain}"
+    @url ||= Rails.env.development? ? "http://#{host}:3000" : "https://#{host}"
   end
 
   def to_s
diff --git a/app/models/user/with_authentication.rb b/app/models/user/with_authentication.rb
index 5e68ea7505b38c8a540771d62b5510c81edcb56f..27d1d9b2ba992b3315b76fdd93409a82afc25e4b 100644
--- a/app/models/user/with_authentication.rb
+++ b/app/models/user/with_authentication.rb
@@ -24,6 +24,23 @@ module User::WithAuthentication
       where(email: warden_conditions[:email].downcase, university_id: warden_conditions[:university_id]).first
     end
 
+    def self.send_confirmation_instructions(attributes = {})
+      confirmable = find_by_unconfirmed_email_with_errors(attributes) if reconfirmable
+      unless confirmable.try(:persisted?)
+        confirmable = find_or_initialize_with_errors(confirmation_keys, attributes, :not_found)
+      end
+      confirmable.registration_context = attributes[:registration_context] if attributes.has_key?(:registration_context)
+      confirmable.resend_confirmation_instructions if confirmable.persisted?
+      confirmable
+    end
+
+    def self.send_unlock_instructions(attributes = {})
+      lockable = find_or_initialize_with_errors(unlock_keys, attributes, :not_found)
+      lockable.registration_context = attributes[:registration_context] if attributes.has_key?(:registration_context)
+      lockable.resend_unlock_instructions if lockable.persisted?
+      lockable
+    end
+
     # Inject a session_token in user salt to prevent Cookie session hijacking
     # https://makandracards.com/makandra/53562-devise-invalidating-all-sessions-for-a-user
     def authenticatable_salt
diff --git a/app/models/user/with_registration_context.rb b/app/models/user/with_registration_context.rb
index 61a8902bdf4163b75019286e60aae0c5cc6d2931..f737c298b0674306b46ebefaedcdc1e2e9018914 100644
--- a/app/models/user/with_registration_context.rb
+++ b/app/models/user/with_registration_context.rb
@@ -4,7 +4,7 @@ module User::WithRegistrationContext
   included do
     attr_accessor :registration_context
 
-    validate :extranet_access, if: -> { registration_context.is_a?(Communication::Extranet) }
+    validate :extranet_access, on: :create, if: -> { registration_context.is_a?(Communication::Extranet) }
 
     private
 
diff --git a/app/views/admin/communication/extranets/_form.html.erb b/app/views/admin/communication/extranets/_form.html.erb
index 4771ec94a56b8da3cb0fedbb828f57517616856f..e61fd03cb51ccaa8f35dd75555ebb1ca1047919f 100644
--- a/app/views/admin/communication/extranets/_form.html.erb
+++ b/app/views/admin/communication/extranets/_form.html.erb
@@ -10,7 +10,7 @@
         </div>
         <div class="card-body">
           <%= f.input :name %>
-          <%= f.input :domain %>
+          <%= f.input :host %>
           <%= render 'admin/communication/abouts', f: f, i18n_key: 'activerecord.attributes.communication/extranet.about_' %>
           <%= f.input :registration_contact %>
         </div>
diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml
index 3f28e9e1f78ecedfa6312014fb29c940eba3ec47..04d9ced40c8075a89ad8e86c560cac0228ab72f4 100644
--- a/config/locales/communication/en.yml
+++ b/config/locales/communication/en.yml
@@ -48,8 +48,8 @@ en:
         about_Research::Journal: Journal extranet
         about_Research::Laboratory: Laboratory extranet
         about_type: About
-        domain: Domain
         has_sso: Has SSO?
+        host: Domain
         name: Name
         registration_contact: Contact mail for registrations problems
         sso_cert: Certificate
diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml
index 5b3e5b824523f146ed140a77bd6f9bc005562fec..0aa0ff1be20480fb4a0849d5eddf42f088bea147 100644
--- a/config/locales/communication/fr.yml
+++ b/config/locales/communication/fr.yml
@@ -48,8 +48,8 @@ fr:
         about_Research::Journal: Extranet d'une revue scientifique
         about_Research::Laboratory: Extranet d'un laboratoire
         about_type: Type d'extranet
-        domain: Domaine
         has_sso: A un SSO ?
+        host: Domaine
         name: Nom
         registration_contact: Mail de contact pour les problèmes d'inscription
         sso_cert: Certificat
diff --git a/db/migrate/20221020102322_rename_domain_to_host_in_communication_extranets.rb b/db/migrate/20221020102322_rename_domain_to_host_in_communication_extranets.rb
new file mode 100644
index 0000000000000000000000000000000000000000..92ee954d7eb30a35e2259b1e243900a7785bd0c8
--- /dev/null
+++ b/db/migrate/20221020102322_rename_domain_to_host_in_communication_extranets.rb
@@ -0,0 +1,5 @@
+class RenameDomainToHostInCommunicationExtranets < ActiveRecord::Migration[6.1]
+  def change
+    rename_column :communication_extranets, :domain, :host
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 378d4e33b8da0c1b25d07c0771d5fcff0eda0909..f96e2e3aa0d2bae7215bd517f81412415254b9cd 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -44,7 +44,7 @@ ActiveRecord::Schema.define(version: 2022_10_20_124935) do
     t.text "metadata"
     t.string "service_name", null: false
     t.bigint "byte_size", null: false
-    t.string "checksum", null: false
+    t.string "checksum"
     t.datetime "created_at", null: false
     t.uuid "university_id"
     t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
@@ -97,7 +97,7 @@ ActiveRecord::Schema.define(version: 2022_10_20_124935) do
   create_table "communication_extranets", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
     t.string "name"
     t.uuid "university_id", null: false
-    t.string "domain"
+    t.string "host"
     t.datetime "created_at", precision: 6, null: false
     t.datetime "updated_at", precision: 6, null: false
     t.string "about_type"
diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml
index 4007d65301ee625a01ed1cc88fd646cfe14fb972..ef11f5bc480834bb3b3dcfd44bfbb9722cbd9144 100644
--- a/test/fixtures/communication/extranets.yml
+++ b/test/fixtures/communication/extranets.yml
@@ -4,8 +4,8 @@
 #
 #  id                          :uuid             not null, primary key
 #  about_type                  :string           indexed => [about_id]
-#  domain                      :string
 #  has_sso                     :boolean          default(FALSE)
+#  host                        :string
 #  name                        :string
 #  registration_contact        :string
 #  sso_cert                    :text
@@ -32,9 +32,9 @@
 one:
   name: MyString
   university: default_university
-  domain: MyString
+  host: MyString
 
 two:
   name: MyString
   university: default_university
-  domain: MyString
+  host: MyString
diff --git a/test/models/communication/extranet_test.rb b/test/models/communication/extranet_test.rb
index b8f875645acb29b034fd7eea695eb65f09e3c3b1..e203e954b701627db5afb0185c2941e740214111 100644
--- a/test/models/communication/extranet_test.rb
+++ b/test/models/communication/extranet_test.rb
@@ -4,8 +4,8 @@
 #
 #  id                          :uuid             not null, primary key
 #  about_type                  :string           indexed => [about_id]
-#  domain                      :string
 #  has_sso                     :boolean          default(FALSE)
+#  host                        :string
 #  name                        :string
 #  registration_contact        :string
 #  sso_cert                    :text