Commit ed327644 authored by ergonlogic's avatar ergonlogic Committed by llamech

Issue #3034235 by llamech, ergonlogic: Use alias redirection target in install login links.

parent 03a72e65
...@@ -366,8 +366,14 @@ function install_main() { ...@@ -366,8 +366,14 @@ function install_main() {
$client_email = install_validate_client_email(drush_get_option('client_email', FALSE)); $client_email = install_validate_client_email(drush_get_option('client_email', FALSE));
$account = install_create_admin_user($client_email); $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_set_option('login_link', $onetime . '/login');
drush_log(dt('Login url: !onetime', array('!onetime' => $onetime . '/login')), 'success'); drush_log(dt('Login url: !onetime', array('!onetime' => $onetime . '/login')), 'success');
......
...@@ -158,10 +158,16 @@ function install_main() { ...@@ -158,10 +158,16 @@ function install_main() {
_provision_drupal_create_directories(); _provision_drupal_create_directories();
$account = user_load(1); $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
drush_set_option('login_link', $onetime . '/login'); // we generate the login link, below.
drush_log(dt('Login url: !onetime', array('!onetime' => $onetime . '/login')), 'success'); _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)) { if (drush_get_option('client_email', FALSE)) {
install_send_welcome_mail($url, $account, $install_locale, $client_email, $onetime); install_send_welcome_mail($url, $account, $install_locale, $client_email, $onetime);
......
...@@ -159,8 +159,13 @@ function install_main() { ...@@ -159,8 +159,13 @@ function install_main() {
$account = user_load(1); $account = user_load(1);
$onetime = user_pass_reset_url($account); // If a redirect is defined, the symlink to the alias needs to exist before
// Store the one time login link in an option so the front end can direct the user to their new site. // 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_set_option('login_link', $onetime);
drush_log(dt('Login url: !onetime', array('!onetime' => $onetime)), 'message'); drush_log(dt('Login url: !onetime', array('!onetime' => $onetime)), 'message');
......
...@@ -491,3 +491,12 @@ function provision_hosting_feature_enabled($feature) { ...@@ -491,3 +491,12 @@ function provision_hosting_feature_enabled($feature) {
return array_key_exists($feature, $features) && $features[$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'];
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment