Skip to content
Snippets Groups Projects
Commit 15be99e6 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

Merge branch 'main' of github.com:noesya/osuny

parents 3eafd40b 3401648f
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,9 @@ GIT
GIT
remote: https://github.com/noesya/two_factor_authentication.git
revision: 55807c784803abb1f93000adab3e3b3f518b508b
revision: ab9734c72d389aefe8ff566d41a0c35bfe5ec989
specs:
two_factor_authentication (3.0.2)
two_factor_authentication (4.0.0)
devise
encryptor
rails (>= 3.1.1)
......
......@@ -55,6 +55,14 @@ module User::WithAuthentication
true
end
def send_new_otp(request, options = {})
current_extranet = Communication::Extranet.with_host(request.host)
current_university = University.with_host(request.host)
current_university ||= university
self.registration_context = current_extranet || current_university
super
end
def direct_otp_default_delivery_method
mobile_phone.present? ? :mobile_phone : :email
end
......
......@@ -4,7 +4,7 @@ module Sendinblue
def self.send_mfa_code(user, code)
duration = ActiveSupport::Duration.build(Rails.application.config.devise.direct_otp_valid_for).inspect
message = I18n.t('sms_code', code: code, university: user.university, duration: duration)
message = I18n.t('sms_code', code: code, context: user.registration_context, duration: duration)
self.send_message(user, message)
end
......
<p><%= t('devise.mailer.two_factor_authentication_code.text_html', university: @university, code: @code, duration: @duration) %></p>
<p><%= t('devise.mailer.two_factor_authentication_code.text_html', context: @resource.registration_context, code: @code, duration: @duration) %></p>
......@@ -130,7 +130,7 @@ en:
mailer:
two_factor_authentication_code:
subject: "Two-factor authentication code"
text_html: "Your two-factor authentication code for %{university} is: <br><br><b>%{code}</b><br><br>It will expire in %{duration}."
text_html: "Your two-factor authentication code for %{context} is: <br><br><b>%{code}</b><br><br>It will expire in %{duration}."
omniauth_callbacks:
failure: "Failed to sign in."
passwords:
......@@ -268,7 +268,7 @@ en:
test_chars: "%{min_length} characters min."
show: Show
slug_error: can only contain downcase letters, numbers, and dashes.
sms_code: "%{code} is your authentication code on %{university} (valid %{duration})"
sms_code: "%{code} is your authentication code on %{context} (valid %{duration})"
static: Static file
terms_of_service: Terms of service
terms_of_service_url: https://osuny.org/conditions-d-utilisation
......
......@@ -130,7 +130,7 @@ fr:
mailer:
two_factor_authentication_code:
subject: "Code d'authentification à deux facteurs"
text_html: "Votre code d'authentification pour %{university} est :<br><br><b>%{code}</b><br><br>Il expirera dans %{duration}."
text_html: "Votre code d'authentification pour %{context} est :<br><br><b>%{code}</b><br><br>Il expirera dans %{duration}."
omniauth_callbacks:
failure: "Échec de l'authentification."
passwords:
......@@ -268,7 +268,7 @@ fr:
test_chars: "%{min_length} caractères min."
show: Voir
slug_error: ne peut contenir que des lettres minuscules, des chiffres et des traits d'union.
sms_code: "%{code} est votre code d'authentification sur %{university} (valide %{duration})"
sms_code: "%{code} est votre code d'authentification sur %{context} (valide %{duration})"
static: Fichier statique
terms_of_service: Conditions d'utilisation
terms_of_service_url: https://osuny.org/conditions-d-utilisation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment