diff --git a/platform/drupal/install_6.inc b/platform/drupal/install_6.inc index 2a8316f5aa1f47203c769854371e69b0287bfac3..e4000f85472d326b820e19a107c1539a0e80ba00 100644 --- a/platform/drupal/install_6.inc +++ b/platform/drupal/install_6.inc @@ -366,8 +366,14 @@ function install_main() { $client_email = install_validate_client_email(drush_get_option('client_email', FALSE)); $account = install_create_admin_user($client_email); - $onetime = user_pass_reset_url($account); - // Store the one time login link in an option so the front end can direct the user to their new site. + + // If a redirect is defined, the symlink to the alias needs to exist before + // we generate the login link, below. + _provision_drupal_maintain_aliases(); + + // Store the one time login link in an option so the front end can direct the + // user to their new site. + $onetime = provision_generate_login_reset(); drush_set_option('login_link', $onetime . '/login'); drush_log(dt('Login url: !onetime', array('!onetime' => $onetime . '/login')), 'success'); diff --git a/platform/drupal/install_7.inc b/platform/drupal/install_7.inc index 73f9aac1bb44987df7994558efc269b36489759e..9efa9264bebd5a5e3f2f53617e84dc0254e7de45 100644 --- a/platform/drupal/install_7.inc +++ b/platform/drupal/install_7.inc @@ -158,10 +158,16 @@ function install_main() { _provision_drupal_create_directories(); $account = user_load(1); - $onetime = user_pass_reset_url($account); - // Store the one time login link in an option so the front end can direct the user to their new site. - drush_set_option('login_link', $onetime . '/login'); - drush_log(dt('Login url: !onetime', array('!onetime' => $onetime . '/login')), 'success'); + + // If a redirect is defined, the symlink to the alias needs to exist before + // we generate the login link, below. + _provision_drupal_maintain_aliases(); + + // Store the one time login link in an option so the front end can direct the + // user to their new site. + $onetime = provision_generate_login_reset(); + drush_set_option('login_link', $onetime); + drush_log(dt('Login url: !onetime', array('!onetime' => $onetime)), 'success'); if (drush_get_option('client_email', FALSE)) { install_send_welcome_mail($url, $account, $install_locale, $client_email, $onetime); diff --git a/platform/drupal/install_8.inc b/platform/drupal/install_8.inc index 87f96e2b7658a60a40325de0bb80f662fde470b5..d56c5039b08b77660362f034574351bd867c5339 100644 --- a/platform/drupal/install_8.inc +++ b/platform/drupal/install_8.inc @@ -159,8 +159,13 @@ function install_main() { $account = user_load(1); - $onetime = user_pass_reset_url($account); - // Store the one time login link in an option so the front end can direct the user to their new site. + // If a redirect is defined, the symlink to the alias needs to exist before + // we generate the login link, below. + _provision_drupal_maintain_aliases(); + + // Store the one time login link in an option so the front end can direct the + // user to their new site. + $onetime = provision_generate_login_reset(); drush_set_option('login_link', $onetime); drush_log(dt('Login url: !onetime', array('!onetime' => $onetime)), 'message'); diff --git a/provision.drush.inc b/provision.drush.inc index 81979bc84755c475a2cbd461e55ec024b4981702..128e31601c0ae4a3c0d72c153f66c21580ec581d 100644 --- a/provision.drush.inc +++ b/provision.drush.inc @@ -491,3 +491,12 @@ function provision_hosting_feature_enabled($feature) { return array_key_exists($feature, $features) && $features[$feature]; } +/** + * Generate one-time login link + */ +function provision_generate_login_reset() { + $uri = d()->redirection ?: d()->uri; + $result = drush_invoke_process(d()->name, 'user-login', array(), array('uri' => $uri, 'no-browser' => TRUE)); + + return $result['output']; +}