From ed9d78d2f3fea64ec8908dc2caacb98fd49a5059 Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 17 Feb 2023 13:15:13 +0100 Subject: [PATCH] Fixes for config.account_create_auto_login --- system/pages/account/create.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/system/pages/account/create.php b/system/pages/account/create.php index 551d6d1e..6c66a351 100644 --- a/system/pages/account/create.php +++ b/system/pages/account/create.php @@ -156,9 +156,12 @@ if($save) if(empty($errors)) { + $hasBeenCreatedByEMail = false; + $new_account = new OTS_Account(); if (config('account_login_by_email')) { $new_account->createWithEmail($email); + $hasBeenCreatedByEMail = true; } else { if(USE_ACCOUNT_NAME) @@ -250,11 +253,17 @@ if($save) } } - if($config['account_create_auto_login']) { - $_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id; + if(config('account_create_auto_login')) { + if ($hasBeenCreatedByEMail) { + $_POST['account_login'] = $email; + } + else { + $_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id; + } + $_POST['password_login'] = $password2; - require SYSTEM . 'login.php'; + require PAGES . 'account/login.php'; header('Location: ' . getLink('account/manage')); }