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 8ed76e868..4543070fe 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 59aa51ed6..69629c40d 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 0af2d4c19..207a50d4a 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."