diff --git a/app/controllers/admin/communication/extranets_controller.rb b/app/controllers/admin/communication/extranets_controller.rb index b9e807a79fba5d54a0d17563696414b035a038d3..ed971661f406799a13f421115caadcf6c328db0a 100644 --- a/app/controllers/admin/communication/extranets_controller.rb +++ b/app/controllers/admin/communication/extranets_controller.rb @@ -67,7 +67,7 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat .permit(:name, :host, :about_type, :about_id, :registration_contact, :logo, :logo_delete, :terms, :privacy_policy, :cookies_policy, :color, - :has_sso, :sso_target_url, :sso_cert, :sso_name_identifier_format, :sso_mapping + :has_sso, :sso_target_url, :sso_cert, :sso_name_identifier_format, :sso_mapping, :sso_button_label ) end end diff --git a/app/controllers/server/universities_controller.rb b/app/controllers/server/universities_controller.rb index 7993a87cfea8b6c12957c0e7ad198585dba0c135..5628d8d2b472d1566188e0f1732df2daaa254fb6 100644 --- a/app/controllers/server/universities_controller.rb +++ b/app/controllers/server/universities_controller.rb @@ -62,7 +62,7 @@ class Server::UniversitiesController < Server::ApplicationController params.require(:university).permit(:name, :address, :zipcode, :city, :country, :private, :identifier, :logo, :logo_delete, :sms_sender_name, - :has_sso, :sso_target_url, :sso_cert, :sso_name_identifier_format, :sso_mapping, + :has_sso, :sso_target_url, :sso_cert, :sso_name_identifier_format, :sso_mapping, :sso_button_label, :invoice_date, :invoice_amount) end end diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb index cd9c9bd78c090602877456946bf0c1bb34930ad8..fecf9450552a2c2aa121aeb8935f8fec3babdad6 100644 --- a/app/models/communication/extranet.rb +++ b/app/models/communication/extranet.rb @@ -11,6 +11,7 @@ # name :string # privacy_policy :text # registration_contact :string +# sso_button_label :string # sso_cert :text # sso_mapping :jsonb # sso_name_identifier_format :string diff --git a/app/models/university.rb b/app/models/university.rb index 8780933afc3444dc3fb95fdd9841a590fe3f0f5f..a8c36a09128387baa3cf16757c028b5b090e7b0a 100644 --- a/app/models/university.rb +++ b/app/models/university.rb @@ -16,6 +16,7 @@ # name :string # private :boolean # sms_sender_name :string +# sso_button_label :string # sso_cert :text # sso_mapping :jsonb # sso_name_identifier_format :string diff --git a/app/views/admin/communication/extranets/_form.html.erb b/app/views/admin/communication/extranets/_form.html.erb index db051c124f6adb141133f2d9c95cdd39caa99093..0a84a5f7eb4ca565225f6df3e4651bdb801194b2 100644 --- a/app/views/admin/communication/extranets/_form.html.erb +++ b/app/views/admin/communication/extranets/_form.html.erb @@ -51,6 +51,7 @@ <%= f.input :sso_target_url, required: true %> <%= f.input :sso_cert, required: true %> <%= f.input :sso_name_identifier_format, required: true %> + <%= f.input :sso_button_label %> </div> </div> <div class="col-md-6 sso-inputs"> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index f83922661f0638f6f0199a2330a210d480747458..6e3fe9e20108bda7e7cc596b8689b347432e4b2f 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -2,7 +2,8 @@ <div class="col-md-6 mb-5"> <h2 class="mb-4"><%= t('login.already_registered') %></h2> <% if current_context.has_sso? %> - <p><%= link_to t('login.sign_in_with_sso'), omniauth_authorize_path(resource_name, current_university.sso_provider), method: :post, class: 'btn btn-primary' %></p> + <% button_label = current_context.sso_button_label.blank? ? t('login.sign_in_with_sso') : current_context.sso_button_label %> + <p><%= link_to button_label, omniauth_authorize_path(resource_name, current_context.sso_provider), method: :post, class: 'btn btn-primary' %></p> <p><%= t('login.or') %></p> <a href="#collapseLoginForm" class="btn btn-primary mb-3" data-bs-toggle="collapse"><%= t('login.sign_in_with_credentials') %></a> <% end %> diff --git a/app/views/server/universities/_form.html.erb b/app/views/server/universities/_form.html.erb index 9dfd61fc25e325fe42de748d554f22fe43fb095a..90b60f85f0dd4c8f8f7038c24d3e5ed3062a1732 100644 --- a/app/views/server/universities/_form.html.erb +++ b/app/views/server/universities/_form.html.erb @@ -39,6 +39,7 @@ <%= f.input :sso_target_url, required: true %> <%= f.input :sso_cert, required: true %> <%= f.input :sso_name_identifier_format, required: true %> + <%= f.input :sso_button_label %> </div> </div> <div class="col-md-6 sso-inputs"> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index cd80a8effb9347564753b193cf4e9b3178b9528d..608e49d9925d8bf72274de384cf57571a374ef88 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -56,6 +56,7 @@ en: host: Domain name: Name registration_contact: Contact mail for registrations problems + sso_button_label: Sign in button's label sso_cert: Certificate sso_inherit_from_university: SSO inherited from University sso_mapping: Mapping @@ -662,6 +663,8 @@ en: url: URL simple_form: hints: + communication_extranet: + sso_button_label: "Default: Sign in via SSO" communication_website: git_branch: 'If blank, default branch will be used' git_endpoint: 'If blank, default will be used (https://github.com or https://gitlab.com/api/v4)' diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 708e029d0496406689b685e031b68ed5a7ded240..9a527d1ecf98725285e6950cf315602c32cebcde 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -55,6 +55,7 @@ fr: name: Nom privacy_policy: Politique de confidentialité registration_contact: Mail de contact pour les problèmes d'inscription + sso_button_label: Libellé du bouton de connexion sso_cert: Certificat sso_inherit_from_university: SSO hérité de l'Université sso_mapping: Mapping @@ -667,6 +668,8 @@ fr: url: URL simple_form: hints: + communication_extranet: + sso_button_label: "Par défaut : Se connecter en SSO" communication_website: git_branch: 'Laisser vide pour la branche par défaut' git_endpoint: 'Laisser vide pour les valeurs par défaut (https://github.com ou https://gitlab.com/api/v4)' diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index cfb308921a30e80186088287ffd404a3e5d85726..268dfdd47b2d676912b3ef4cdf28cf3e3d8d2dd2 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -15,6 +15,7 @@ en: public: Public public_or_private: Public/private sms_sender_name: SMS sender name + sso_button_label: Sign in button's label sso_cert: Certificate sso_mapping: Mapping sso_name_identifier_format: Name Identifier Format @@ -130,6 +131,7 @@ en: hints: university: sms_sender_name: "11 characters max. Only alphanumeric chars ([A-Z][a-z][0-9])." + sso_button_label: "Default: Sign in via SSO" university_organization: description: If this field is empty the main text's begining will be used. university_person: diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 823b655ae7d6190c41d2e2a221cbf3041a99d6e4..a2845536b867fbe6c0aa226a7c7ac508efcbdacc 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -15,6 +15,7 @@ fr: public: Public public_or_private: Public/privé sms_sender_name: Nom de l'expéditeur SMS + sso_button_label: Libellé du bouton de connexion sso_cert: Certificat sso_mapping: Mapping sso_name_identifier_format: Name Identifier Format @@ -130,6 +131,7 @@ fr: hints: university: sms_sender_name: "11 caractères maximum. Que des caractères alphadécimaux ([A-Z][a-z][0-9])." + sso_button_label: "Par défaut : Se connecter en SSO" university_organization: description: Si ce champ est vide le début du texte principal sera utilisé. university_person: diff --git a/db/migrate/20221031155827_add_sso_button_label.rb b/db/migrate/20221031155827_add_sso_button_label.rb new file mode 100644 index 0000000000000000000000000000000000000000..475bef3a8ab82927fc58d72fd02d63be5dcc4291 --- /dev/null +++ b/db/migrate/20221031155827_add_sso_button_label.rb @@ -0,0 +1,6 @@ +class AddSsoButtonLabel < ActiveRecord::Migration[6.1] + def change + add_column :universities, :sso_button_label, :string + add_column :communication_extranets, :sso_button_label, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 0664d124b1f5022b833734219be4a38f8ea424fb..e6595bf33446474d5bc7725f5a405ceac0f7f5b3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_10_24_145426) do +ActiveRecord::Schema.define(version: 2022_10_31_155827) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -44,7 +44,7 @@ ActiveRecord::Schema.define(version: 2022_10_24_145426) 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 @@ -113,6 +113,7 @@ ActiveRecord::Schema.define(version: 2022_10_24_145426) do t.text "privacy_policy" t.text "cookies_policy" t.string "color" + t.string "sso_button_label" t.index ["about_type", "about_id"], name: "index_communication_extranets_on_about" t.index ["university_id"], name: "index_communication_extranets_on_university_id" end @@ -672,6 +673,7 @@ ActiveRecord::Schema.define(version: 2022_10_24_145426) do t.text "sso_cert" t.string "sso_name_identifier_format" t.jsonb "sso_mapping" + t.string "sso_button_label" end create_table "university_organizations", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml index 096e5b66c1bd77ea1abe94d2063174daa49f8763..fa530b05dc39e3bba0a50ce627f0bc81732644ee 100644 --- a/test/fixtures/communication/extranets.yml +++ b/test/fixtures/communication/extranets.yml @@ -11,6 +11,7 @@ # name :string # privacy_policy :text # registration_contact :string +# sso_button_label :string # sso_cert :text # sso_mapping :jsonb # sso_name_identifier_format :string diff --git a/test/fixtures/universities.yml b/test/fixtures/universities.yml index 112c47a9b4409afd2adaa9d16373f6702af8e1eb..e51e10e50f4ca8868060a634b4aaa7e0562acc38 100644 --- a/test/fixtures/universities.yml +++ b/test/fixtures/universities.yml @@ -16,6 +16,7 @@ # name :string # private :boolean # sms_sender_name :string +# sso_button_label :string # sso_cert :text # sso_mapping :jsonb # sso_name_identifier_format :string diff --git a/test/models/communication/extranet_test.rb b/test/models/communication/extranet_test.rb index 69be8d1cd6fe3afbadbecda1a9572a0cfb3e3eef..0b396fd48f3595a831e321d3b9c27fe2c11104b8 100644 --- a/test/models/communication/extranet_test.rb +++ b/test/models/communication/extranet_test.rb @@ -11,6 +11,7 @@ # name :string # privacy_policy :text # registration_contact :string +# sso_button_label :string # sso_cert :text # sso_mapping :jsonb # sso_name_identifier_format :string