Skip to content

Commit

Permalink
revert-560-revert-556-UHF-9531: UHF-9531: Update login button texts
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky committed Feb 8, 2024
1 parent 28dc285 commit 9f3a959
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conf/cmi/openid_connect.client.tunnistamo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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' => '<p>',
'#suffix' => '</p>',
'#plain_text' => new TranslatableMarkup('Sign in like before using your Helsinki1 credentials.', [], [
'context' => 'Kasko teacher sign in',
]),
];

$form['openid_connect_client_tunnistamo_login'] = $build;
}
}
12 changes: 10 additions & 2 deletions public/modules/custom/helfi_kasko_content/translations/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -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."
8 changes: 8 additions & 0 deletions public/modules/custom/helfi_kasko_content/translations/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -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."

0 comments on commit 9f3a959

Please sign in to comment.