• Stars
    star
    268
  • Rank 152,718 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Log in to WordPress with secure passwordless magic links.

WP-CLI Login Command

Login to WordPress with secure passwordless links.

Test Packagist

Quick links: Using | Installation | Contributing

Using

NAME

  wp login

DESCRIPTION

  Manage magic passwordless sign-in.

SYNOPSIS

  wp login <command>

SUBCOMMANDS

  create          Create a magic sign-in link for the given user.
  email           Email a magic sign-in link to the given user.
  install         Install/update the companion server plugin.
  invalidate      Invalidate any existing magic links.
  toggle          Toggle the active state of the companion server plugin.

create / as

wp login create <user> [options]

or alternatively use the alias

wp login as <user> [options]

Create a magic sign-in link for the given user. Outputs the created URL with some extra information for the user regarding usage and expiration. URLs expire 15 minutes after creation (configurable), or at the time of use, whichever comes first.

<user> can be passed as an User ID, username/login or email address. This is the same for all login commands which accept this as a parameter.

--expires=<seconds>

Set the lifetime of the magic link in seconds.

10 minutes = 600
1 hour     = 3600
1 day      = 86400

Default: 900 (15 minutes)

--redirect-url=<url>

Set the URL to redirect to upon successfully logging in. Defaults to admin_url().

Note: The redirect is executed using wp_safe_redirect which restricts the destination URL using a list of allowed hosts. By default, this is limited to the domain of the site, but can be extended using the allowed_redirect_hosts filter.

--url-only

Outputs the created sign-in URL only. Great for scripting, piping to your clipboard, or anything else you can think of.

--launch

Launches the sign-in link your default browser immediately after creation. This is the fastest possible way to login.

email

wp login email <user> [options]

Email a magic sign-in link to the given user. Sends a nice HTML email to the user's email address containing their freshly created magic sign-in link. Planning to add support for both HTML and plain text emails in the future.

--expires=<seconds>

See above.

--redirect-url=<url>

See above.

--subject=<email-subject>

Optionally override the default email subject with your own custom string. You may use the {{ domain }} placeholder.

Default: Magic log-in link for {{domain}}

--template=<path-to-custom-template>

Optionally override the default email template with your own by providing the path to a different template file to use. The email template is compiled using the Mustache template engine, so you may use the {{ magic_url }} and {{ domain }} placeholders in your custom template. The default template can be found in this repository under template/email-default.mustache.

install

wp login install [options]

Install/update the companion server plugin. Installing the companion plugin is required before magic links will work on the host. The login command is aware of the installed version of the plugin, and will inform you if it needs to be installed, activated or upgraded. If the plugin is already installed, you will be prompted to overwrite it.

--activate

Optionally activate the plugin immediately after installation.

--yes

Suppress prompting for confirmation to overwrite the existing plugin.

Using a Composer-based WordPress install? You can require the companion plugin using the package aaemnnosttv/wp-cli-login-server.

invalidate

wp login invalidate

Invalidate any existing magic sign-in links. Any previously created links will most likely go to a 404 page.

toggle

wp login toggle [<on|off>]

Toggles the active status of the companion plugin. Optionally pass on or off to set the activation accordingly. Without it, the status is simply inverted.

Installation

Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with wp cli update.

Once you've done so, you can install this package with wp package install aaemnnosttv/wp-cli-login-command.

Contributing

We appreciate you taking the initiative to contribute to this project.

Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

Reporting a bug

Think you’ve found a bug? We’d love for you to help us get it fixed.

Before you create a new issue, you should search existing issues to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.

Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please create a new issue with the following:

  1. What you were doing (e.g. "When I run wp post list").
  2. What you saw (e.g. "I see a fatal about a class being undefined.").
  3. What you expected to see (e.g. "I expected to see the list of posts.")

Include as much detail as you can, and clear steps to reproduce if possible.

Creating a pull request

Want to contribute a new feature? Please first open a new issue to discuss whether the feature is a good fit for the project.

Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:

  1. Create a feature branch for each contribution.
  2. Submit your pull request early for feedback.
  3. Include functional tests with your changes. Read the WP-CLI documentation for an introduction.
  4. Follow PSR-2 Coding Standards.

More Repositories

1

wp-sqlite-db

A single file drop-in for using a SQLite database with WordPress. Based on the original SQLite Integration plugin.
PHP
491
star
2

wp-cli-valet-command

Harness the power of Laravel Valet for creating fully functional WordPress installs in seconds.
PHP
286
star
3

wp-cli-dotenv-command

Interact with a .env file from the command line.
PHP
168
star
4

silk

A modern API for WordPress.
PHP
67
star
5

valet-dashboard

A simple dashboard for Laravel Valet to display all available sites.
PHP
22
star
6

version-assets

A WordPress plugin to automatically apply a content-based version on all of your assets to optimize browser caching.
PHP
15
star
7

wp-plugin-activation-manifest

PHP
11
star
8

wp-sqlite-integration

PHP
10
star
9

silk-docs

Silk Documentation. For API docs, see here: https://api.silk.aaemnnost.tv/master/
9
star
10

wordpress-tests-core

This project is deprecated. See WP PHPUnit! ->>>>
PHP
9
star
11

boiler

A WordPress plugin boilerplate
Shell
7
star
12

last-modified-timestamp

A WordPress plugin for making the last modified date/time more accessible.
PHP
6
star
13

wp-cli-media-generate-command

A WP-CLI Command for generating media items and importing them into the media library.
PHP
5
star
14

quick-tab-switcher

Browser extension for switching tabs in a flash, without leaving the keyboard.
JavaScript
5
star
15

purity

A conflict-free utility library.
PHP
5
star
16

bedrock-valet-driver

Laravel Valet Driver for the Roots Bedrock WordPress application project boilerplate
PHP
4
star
17

pagelines

PageLines Framework 2.X made updateable with https://github.com/afragen/github-updater
PHP
4
star
18

wp-cli-http-command

WP-CLI command for using the WordPress HTTP API
PHP
4
star
19

wpenv

Environment-specific control for WordPress installs
PHP
4
star
20

wp-cli-login-server

[READ ONLY] Subtree split of wp-cli-login-command server plugin. (See aaemnnosttv/wp-cli-login-command)
PHP
4
star
21

post-link-shortcodes

A collection of shortcodes for building links, images, or URLs to a given post/archive of any type.
PHP
3
star
22

html5-analytics

Dead-simple Google Analytics event tracking using HTML5 data attributes
JavaScript
2
star
23

gskbuild

Shell
2
star
24

War.php

A high-performance engine for playing the card game of War.
PHP
2
star
25

bedrock-mailtrap

A Mailtrap plugin for Roots Bedrock.
PHP
2
star
26

silk-plugin

Silk: The WordPress plugin.
PHP
1
star
27

webgloss

A toy glossary app, using Laravel, Vue.js, and Bootstrap 4
PHP
1
star
28

pagelines-developer

A plugin for pagelines developers developers developers
CSS
1
star
29

wp-env-auto-privacy

A WordPress plugin for (trying to) ensure that non-production sites are not indexed by search engines.
PHP
1
star
30

deprecated-hooks

PHP
1
star
31

shortcode-alias-api

A WordPress plugin for providing an API to create powerful shortcode aliases.
PHP
1
star
32

nag-squelcher

Shush with the nagging!
PHP
1
star
33

docker-sage-build

A docker container for running the Roots Sage theme build.
1
star