Better Quick Login

By Chema

0+ active installationsVersion 1.3

Passwordless login for WordPress: users get a secure one time link by email, no password needed.

Description

Better Quick Login removes passwords from the login process. Instead of typing a password, the user enters their username or email address and receives a one time login link in their inbox. One click and they are in.

That is easier for members who visit your site from time to time and forget their password, and it is also safer: there is no password to reuse, to leak in a database dump or to guess. Links are random, single use and expire after the time you choose.

Features

  • Passwordless login: one form, one field, one email. No password to remember.
  • Single use links: every link works once and is deleted after logging in.
  • Expiring links: 10 minutes, 30 minutes, 1 hour, 12 hours or 1 day, configurable.
  • Shortcode: drop [bqlc_quicklogin] anywhere to show the form.
  • Block: a “Quick Login Block” for the block editor.
  • Widget: a “Quick Login” widget for sidebars and footers.
  • Replace the WordPress login form: optional, shows the passwordless form on wp-login.php above the normal one.
  • One session per user: optional, closes the other sessions of a user when a new one starts. Administrators are never affected.
  • Optional reCAPTCHA v3: site key and secret key, verified on the server.
  • Email throttling: one request per minute and IP, so the form can not be used to flood an inbox.
  • Translations ready: English and Spanish included.

How it works

  1. The user enters their username or email address in the form.
  2. The plugin generates a random token, saves it in the user meta with an expiration time and emails a link with that token.
  3. When the user opens the link, the plugin checks the token, checks that it has not expired and logs the user in. The token is deleted immediately, so the link can not be reused.

Nothing is sent to any third party service. Email goes through your usual WordPress mail setup, and reCAPTCHA is only contacted if you configure it.

Installation

  1. Install the plugin from the Plugins > Add New screen, or upload the better-quick-login folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Go to Settings > Quick Login to choose the link expiration and the rest of the options.
  4. Add the form anywhere with the shortcode [bqlc_quicklogin], the block or the widget, or enable Add to WordPress Login to show it on wp-login.php.

FAQ

How can I add the Quick Login form to my content?

Use the shortcode [bqlc_quicklogin], the “Quick Login Block” in the block editor, or the “Quick Login” widget in any widget area.

Can I customize the appearance of the login form?

Yes. The form lives in templates/login-form.php and the styles in css/styles.css. Copy the template into your theme (as better-quick-login/login-form.php) if you prefer not to edit the plugin file, so future updates do not overwrite your changes.

How do I limit users to one session at a time?

Enable “Force 1 Session per User” in the plugin settings. When a user logs in, the other sessions of that same user are closed. Administrators are excluded on purpose, so you never get logged out of your own admin in another browser.

How do I enable reCAPTCHA?

Create a reCAPTCHA v3 pair of keys in Google and paste both the site key and the secret key in the plugin settings. The captcha starts being enforced as soon as both fields are saved, because the secret is what allows the plugin to verify the token on the server.

Does it work with WooCommerce or a membership plugin?

It does not replace their login forms, but the links it emails log the user in for the whole WordPress session, so they land on your site already authenticated. Use wp_login_url() in those plugins to send users to the WordPress form.

Is it safe to log in without a password?

Yes, as long as the email account is safe, which is the same assumption any password reset makes. Links are generated with random_bytes(), are single use, expire in the time you configure and are only sent to the address stored in the user account.

I stopped receiving the emails

The plugin uses wp_mail(), so whatever email configuration your site uses applies here. If password reset emails arrive but these do not, check that the site can send mail and look at your SMTP plugin logs.

Changelog

1.3

  • Security: the login form printed the current URL without escaping, which allowed reflected XSS through the request URI.
  • Security: the reCAPTCHA was never verified on the server. The site key was sent to Google, the token was discarded, and nothing was checked. It is now verified with the secret key before sending any email, and the setting is optional so existing sites keep working.
  • Security: login tokens were built from md5(uniqid()), which is predictable. They are now generated with random_bytes().
  • Security: the form returned a different message for existing and unknown users, which allowed discovering registered accounts. It now always answers the same.
  • Security: added a one minute throttle per IP so the form can not be used to flood an inbox.
  • Security: wp_redirect() replaced with wp_safe_redirect(), and undefined keys are checked before use.
  • Fixed: PHP warnings on every page load when the nonce parameter was missing.
  • Fixed: “Force 1 Session per User” logged administrators out of their other browsers too.
  • Fixed: the block was registered with the old editor_script argument, deprecated since WordPress 6.1 and the wrong block name. It now uses the block API v2.
  • Fixed: the reCAPTCHA script was printed in the middle of the page and the button had a wrong type; it is now enqueued properly.
  • Fixed: load_plugin_textdomain() removed, WordPress loads the translations of hosted plugins automatically.
  • Fixed: escape every value printed in the templates, and other small coding standard issues.
  • Tested up to WordPress 7.1.
  • Improved the readme: description, features, FAQ and a proper changelog.

1.2.1

  • Compatible WP 6.7
  • Issue login form sending nonce and ql_token when not needed

1.2

  • Compatible WP 6.5
  • Security improvements

1.0

  • Initial release.