Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Disable Login Page

1,438 sites Security covered Drupal 10–11
View on drupal.org

This module protects Drupal's login page from anonymous users by requiring a secret key as part of the URL. It's useful for sites where public login isn't needed, and administrators can configure the secret key and allow programmatic modification.

Disable Login Page is a simple module that prevents access to the default Drupal Login Page to anonymous users without the use of a secret key. This is useful for sites that do not have any public user login requirements like in a corporate website or a personal blog.

The login page is protected with a secret key name value pair which can be set by the admin. When the default login page is accessed without the secret key-value pair, you get an access denied error.

The module also allows the secret key to be programmatically modified by any custom code by exposing an alter hook on the key. If you want to use a custom logic for generating the key you can implement the alter hook in your module.

Users who want to login to the site can bookmark the login page including the secret key.

Configuration

All settings for this module are on the Disable Login configuration page, under the Configuration section, in the Security sub menu. You can visit the configuration page directly at admin/config/security/disable-login.

In addition, you can also completely prevent access to /user/login when accessed without any querystrings, by configuring this at the webserver level.

For apache you can add the following before the section on the rediret
to index.php.

# Block access to /user/login when there are no querystrings
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/user/login
RewriteRule ^.* - [F,L]

Other webservers can be configured similarly.

Examples

Admin user can set both the name of the QueryString and the value which will allow access to the login page.

Eg:

http://example.com/user/login

will give access denied.

http://example.com/user/login?key=secret

will allow the user to access the login page.

If you get locked out

If you are locked out of the system because you forgot the key-value pair

- If you have access to shell, run the following

drush -y config-set disable_login.settings disable_login 0

- If you don't have access to shell but have access to the file system via ftp

Edit disable_login/src/Access/DisableLoginAccessCheck.php file and find hasValidSecretToken function. Add return TRUE; as the first line in the function.

Depends on

Dependencies of the latest stable release

  • user Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Dec 2025
Latest release
5 days ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.1.4 Stable 10–11 Aug 26, 2026
1.1.3 Stable 8–11 Dec 3, 2025