diff --git a/conf/cmi/openid_connect.client.tunnistamo.yml b/conf/cmi/openid_connect.client.tunnistamo.yml index f31f90c3..29dc961b 100644 --- a/conf/cmi/openid_connect.client.tunnistamo.yml +++ b/conf/cmi/openid_connect.client.tunnistamo.yml @@ -7,7 +7,7 @@ dependencies: _core: default_config_hash: nGpk9fP8YMhP_c3Sz_aCQFVhAJyN6eJI6E4Qpnqna-A id: tunnistamo -label: edu.hel.fi +label: Teacher sign in plugin: tunnistamo settings: client_id: placeholder diff --git a/public/modules/custom/helfi_kasko_content/helfi_kasko_content.module b/public/modules/custom/helfi_kasko_content/helfi_kasko_content.module index 8ed76e86..290ab033 100644 --- a/public/modules/custom/helfi_kasko_content/helfi_kasko_content.module +++ b/public/modules/custom/helfi_kasko_content/helfi_kasko_content.module @@ -8,6 +8,7 @@ use Drupal\Core\Access\AccessResult; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; @@ -360,8 +361,31 @@ function helfi_kasko_content_openid_connect_pre_authorize(UserInterface|bool $ac if (!$allowLogin && $pluginId === 'tunnistamo') { \Drupal::messenger() - ->addError(new TranslatableMarkup("Only edu.hel.fi users are allowed to log in with this method.")); + ->addError(new TranslatableMarkup("Only teachers are allowed to log in with this method.")); } return $allowLogin; } + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function helfi_kasko_content_form_openid_connect_login_form_alter(&$form, FormStateInterface $form_state) : void { + // UHF-9531: Add help text to teacher login button. + // @todo remove once separate login is no longer needed for edu users. + if (isset($form['openid_connect_client_tunnistamo_login'])) { + $build['button'] = $form['openid_connect_client_tunnistamo_login']; + $build['button']['#value'] = new TranslatableMarkup('Teacher sign in', [], [ + 'context' => 'Kasko teacher sign in', + ]); + $build['help'] = [ + '#prefix' => '

', + '#suffix' => '

', + '#plain_text' => new TranslatableMarkup('Sign in like before using your Helsinki1 credentials.', [], [ + 'context' => 'Kasko teacher sign in', + ]), + ]; + + $form['openid_connect_client_tunnistamo_login'] = $build; + } +} diff --git a/public/modules/custom/helfi_kasko_content/translations/fi.po b/public/modules/custom/helfi_kasko_content/translations/fi.po index 59aa51ed..69629c40 100644 --- a/public/modules/custom/helfi_kasko_content/translations/fi.po +++ b/public/modules/custom/helfi_kasko_content/translations/fi.po @@ -178,5 +178,13 @@ msgctxt "TPR Ontologyword details schools" msgid "Language offering" msgstr "Kielitarjonta" -msgid "Only edu.hel.fi users are allowed to log in with this method" -msgstr "Vain edu.hel.fi käyttäjät voivat kirjautua tällä kirjautumistavalla." +msgid "Only teachers are allowed to log in with this method" +msgstr "Vain opettajat voivat kirjautua tällä kirjautumistavalla." + +msgctxt "Kasko teacher sign in" +msgid "Teacher sign in" +msgstr "Opettajien kirjautuminen" + +msgctxt "Kasko teacher sign in" +msgid "Sign in like before using your Helsinki1 credentials." +msgstr "Kirjaudu kuten ennenkin, mutta käytä opettajien omaa kirjautumispainiketta." diff --git a/public/modules/custom/helfi_kasko_content/translations/sv.po b/public/modules/custom/helfi_kasko_content/translations/sv.po index 0af2d4c1..207a50d4 100644 --- a/public/modules/custom/helfi_kasko_content/translations/sv.po +++ b/public/modules/custom/helfi_kasko_content/translations/sv.po @@ -177,3 +177,11 @@ msgstr "B2-språket" msgctxt "TPR Ontologyword details schools" msgid "Language offering" msgstr "Språkutbudet" + +msgctxt "Kasko teacher sign in" +msgid "Teacher sign in" +msgstr "Logga in (lärare)" + +msgctxt "Kasko teacher sign in" +msgid "Sign in like before using your Helsinki1 credentials." +msgstr "Logga in som förut med dina Helsinki1-uppgifter."