Skip to content

Commit

Permalink
refactor state setting
Browse files Browse the repository at this point in the history
  • Loading branch information
loganmcdonald-noaa committed May 7, 2024
1 parent 6e702d4 commit 736fe81
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sso_login_path: '/saml/login'
sso_login_text: 'Login via SSO'
sso_cancel_path: '/'
sso_cancel_text: 'Cancel and return home'
sso_cancel_text: 'Cancel and return home'
7 changes: 2 additions & 5 deletions web/modules/weather_login/weather_login.module
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ function weather_login_form_user_login_form_alter(&$form, FormStateInterface $fo
$cancelText = $config->get('sso_cancel_text');

// Allow override for local login forms via $settings[] in settings.*.php
$settings_state = Settings::get('weather_login_local_form', 0);
if ($settings_state || $state) {
$state = 1;
}
$basicAuthSetting = Settings::get('weather_login_local_form', false);

if ($loginPath) {
if (!$state) {
if (!$basicAuthSetting) {
$form['name']['#access'] = false;
$form['pass']['#access'] = false;
$form['actions']['#access'] = false;
Expand Down
2 changes: 1 addition & 1 deletion web/modules/weather_login/weather_login.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ services:
weather_login.user_route_subscriber:
class: Drupal\weather_login\RouteSubscriber\UserLoginRouteSubscriber
tags:
- { name: event_subscriber }
- { name: event_subscriber }

0 comments on commit 736fe81

Please sign in to comment.