Problem

Using external authentication is currently mandatory when using this module. It not only permanently disables the login form, but it also modifies user/login and user/logout menu items and replaces their callbacks with its own - this bars users from logging in using login form, what is sometimes desirable, but sometimes not.

What is more, as the module disables the login block and this means two changed settings in the database, the login form is not automatically available again on the Drupal site after uninstallation of the module. Users have to go to user/login, manually entering the URL into the address bar to reach the login form.

Proposed solution

I suggest creating the webserver_auth_optional_external_auth configuration variable, which will be FALSE by default - this will preserve the current behaviour.

However, when this variable is set to TRUE, then instead assigning external login and logout functionality (the module's functionality) to the standard user/login and user/logout tasks, it will create new tasks user/external_login and user/external_logout. It will also re-enable the login form. The user/external_login task will be reachable by clicking the new link 'Log in externally' in the User menu. If a user will want a link to the user/external_logout task, he can manually create a link to this task in his User menu.

I also suggest re-enabling the login form at module's uninstall - in this case, this will be done by editing the database.

User interface changes

  • A new option will be available on the module's configuration page - after expanding the 'Advanced settings' section, the 'Preserve the ability to log in using local username + password and login form' setting regulates the functionality introduced by this patch.
  • If the afromentioned setting is enabled or if the module is uninstalled, the login form will appear on sites when accessing them as an anonymous user again.
  • If the afromentioned setting is enabled, the external login will now be available as 'Log in externally' shortcut in the User menu.

Files

I have tested this solution and it worked. See file patch3.patch - note that this file is generated from GitHub repository and expects that patches for issues https://www.drupal.org/node/2859664 and https://www.drupal.org/node/2859747 have been applied. I also append 3 screenshots of how it looks like in practice after applying the patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rkalinec created an issue. See original summary.

rkalinec’s picture

rkalinec’s picture

FileSize
8.92 KB
rkalinec’s picture

Issue summary: View changes
FileSize
6.97 KB
rkalinec’s picture

Issue summary: View changes
rkalinec’s picture

Issue summary: View changes
FileSize
6.93 KB