Loading modules/o365_sso/config/install/o365_sso.settings.yml +3 −1 Original line number Diff line number Diff line Loading @@ -2,3 +2,5 @@ auto_redirect: 0 link_position: 1 link_text: 'Login with Microsoft Office' redirect_login_destination: 1 hide_user_fields: 0 hide_login_form: 0 modules/o365_sso/o365_sso.module +13 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,19 @@ function o365_sso_alter_login_form(array &$form, FormStateInterface $form_state, $form['#attached']['library'][] = 'o365/general'; $form['#attached']['library'][] = 'o365/icons'; // Hide form fields when this option is enabled. $hideForm = $config->get('hide_login_form'); if (!empty($hideForm)) { $showLogin = \Drupal::request()->query->get('show_login'); // Only hide when the show_login parameter is not true. if ($showLogin !== 'true') { $form['name']['#access'] = FALSE; $form['pass']['#access'] = FALSE; $form['more-links']['#access'] = FALSE; $form['actions']['submit']['#access'] = FALSE; } } $redirectDestination = $config->get('redirect_login_destination'); $query = []; if (!empty($redirectDestination)) { Loading modules/o365_sso/src/Form/SettingsForm.php +8 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,13 @@ class SettingsForm extends ConfigFormBase { '#description' => $this->t('When disabled the link to the Office login will be shown on the bottom of the login form.'), ]; $form['hide_login_form'] = [ '#type' => 'checkbox', '#title' => $this->t('Hide the login form.'), '#default_value' => $config->get('hide_login_form'), '#description' => $this->t('When enabled nog login form will be shown. This can be overridden with ?show_login=true query parameter.'), ]; $form['auto_redirect'] = [ '#type' => 'checkbox', '#title' => $this->t('Automatically redirect users to the SSO login page.'), Loading Loading @@ -82,6 +89,7 @@ class SettingsForm extends ConfigFormBase { ->set('link_position', $form_state->getValue('link_position')) ->set('redirect_login_destination', $form_state->getValue('redirect_login_destination')) ->set('hide_user_fields', $form_state->getValue('hide_user_fields')) ->set('hide_login_form', $form_state->getValue('hide_login_form')) ->save(); } Loading Loading
modules/o365_sso/config/install/o365_sso.settings.yml +3 −1 Original line number Diff line number Diff line Loading @@ -2,3 +2,5 @@ auto_redirect: 0 link_position: 1 link_text: 'Login with Microsoft Office' redirect_login_destination: 1 hide_user_fields: 0 hide_login_form: 0
modules/o365_sso/o365_sso.module +13 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,19 @@ function o365_sso_alter_login_form(array &$form, FormStateInterface $form_state, $form['#attached']['library'][] = 'o365/general'; $form['#attached']['library'][] = 'o365/icons'; // Hide form fields when this option is enabled. $hideForm = $config->get('hide_login_form'); if (!empty($hideForm)) { $showLogin = \Drupal::request()->query->get('show_login'); // Only hide when the show_login parameter is not true. if ($showLogin !== 'true') { $form['name']['#access'] = FALSE; $form['pass']['#access'] = FALSE; $form['more-links']['#access'] = FALSE; $form['actions']['submit']['#access'] = FALSE; } } $redirectDestination = $config->get('redirect_login_destination'); $query = []; if (!empty($redirectDestination)) { Loading
modules/o365_sso/src/Form/SettingsForm.php +8 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,13 @@ class SettingsForm extends ConfigFormBase { '#description' => $this->t('When disabled the link to the Office login will be shown on the bottom of the login form.'), ]; $form['hide_login_form'] = [ '#type' => 'checkbox', '#title' => $this->t('Hide the login form.'), '#default_value' => $config->get('hide_login_form'), '#description' => $this->t('When enabled nog login form will be shown. This can be overridden with ?show_login=true query parameter.'), ]; $form['auto_redirect'] = [ '#type' => 'checkbox', '#title' => $this->t('Automatically redirect users to the SSO login page.'), Loading Loading @@ -82,6 +89,7 @@ class SettingsForm extends ConfigFormBase { ->set('link_position', $form_state->getValue('link_position')) ->set('redirect_login_destination', $form_state->getValue('redirect_login_destination')) ->set('hide_user_fields', $form_state->getValue('hide_user_fields')) ->set('hide_login_form', $form_state->getValue('hide_login_form')) ->save(); } Loading