dpc-sdp / dev-tools

Tools used for development of Tide distribution and modules.
2 stars 1 forks source link

Ahoy login doesn't work anymore #67

Closed christopher-hopper closed 2 years ago

christopher-hopper commented 2 years ago

Problem / Motivation

There are two problems with the current ahoy login command.

  1. When ahoy build finishes it calls ahoy login but instead of showing a "One-time login" URL in the build status message, it shows nothing and opens a browser window unexpectedly

  2. The ahoy login generates a URL that doesn't work when the admin account is blocked

Steps to reproduce

  1. Clone an SDP project like content-vic
  2. Run ahoy build or ahoy login

Expected result

A one-time login link is generated and shown in the terminal. If I copy the link to a browser it will log me in as user 1.

Actual result

A browser window is opened unexpectedly, even if the terminal is not currently my active window. For an ahoy build this is particularly annoying as it steals window focus, without warning, no matter what I am doing at the time.

The generated link often doesn't work as the user 1 account is blocked or disabled in the Drupal database synced from production.

Suggested fix

The Drush command syntax has changed since this Ahoy command was created. Below is a suggested one-liner to unblock the account and generate a log-in link

drush user:unblock "$(drush user:information --uid=1 --fields=name --format=string)" && drush user:login --no-browser