This project is not covered by Drupal’s security advisory policy.

Swift Login opens the login form in a dropdown under the "Log in" link, on any page. Visitors log in without leaving the page they are on, and see errors right in the dropdown.

Features

  • Dropdown login from the "Log in" link of the user account menu, or any menu, or from the Swift Login button block.
  • Stay on the page: after logging in, visitors come back to the page they were on. Or send them to their account page, or a page you choose.
  • Errors in the dropdown: a wrong password, a blocked account or too many attempts are shown in the dropdown, without a page load.
  • Drupal's own login: the form is core's login form, with its validation and flood control, and works with modules that alter it.
  • Works without JavaScript: the link still goes to the login page.
  • Fast: the form loads only when the dropdown is first opened, so pages stay cacheable for anonymous visitors.
  • Accessible:
    • the link acts as a button, with aria-expanded;
    • the focus moves to the form when it opens;
    • Escape closes the dropdown and returns the focus to the link;
    • it opens with Enter or Space.
  • Helpful links to reset the password and create an account, each only when the visitor can use it.
  • Safe redirects: only pages on your own site are accepted after logging in.

Requirements

  • Drupal 10.3 or later, or Drupal 11.

Installation

Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.

composer require drupal/swift_login
drush pm:enable swift_login

That's it: the "Log in" link of the user account menu now opens the dropdown.

Configuration

At Configuration » People » Swift Login (/admin/config/people/swift-login), choose:

  • whether the "Log in" menu link opens the dropdown;
  • where to go after logging in;
  • whether to show the password reset and registration links;
  • whether the dropdown aligns to the left or right of the link.

To show a button where there is no account menu, place the Swift Login button block. It is shown to anonymous visitors only.

Theming

  • Any link with the data-swift-login attribute opens the dropdown.
  • Style it with .swift-login-dropdown, .swift-login-form and .swift-login-links.

Upgrading from 1.0

Run drush updatedb. The dropdown now loads the form when it is opened, keeps the link working without JavaScript, shows errors in place, and returns visitors to the page they were on.

Support

Report bugs and request features in the issue queue.

Supporting organizations: 
AttachmentSize
Swift_login.png14.15 KB

Project information

Releases