diff --git a/TODO b/TODO index 915e6a97..51954fba 100644 --- a/TODO +++ b/TODO @@ -101,7 +101,6 @@ x.x - At any time between (version not specified) * database towns table support for TFS 1.3 * two factor authentication for TFS 1.x * support for .yml plugin file specification - * (configurable) auto login after registration * display password strength * https://elboletaire.github.io/password-strength-meter/ * apache2, nginx and lighttpd conf like in phpmyadmin diff --git a/config.php b/config.php index f0968c44..1fa9ff39 100644 --- a/config.php +++ b/config.php @@ -90,6 +90,7 @@ $config = array( // account 'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager) + 'account_create_auto_login' => false, // auto login after creating account? 'account_mail_verify' => false, // force users to confirm their email addresses when registering account 'account_mail_unique' => true, // email addresses cannot be duplicated? (one account = one email) 'account_premium_days' => 0, // default premium days on new account diff --git a/system/login.php b/system/login.php index 009b1aef..d5854049 100644 --- a/system/login.php +++ b/system/login.php @@ -12,7 +12,9 @@ $logged = false; $logged_flags = 0; $action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ''; -define('ACTION', $action); +if(!defined('ACTION')) { + define('ACTION', $action); +} // stay-logged with sessions $current_session = getSession('account'); @@ -86,8 +88,8 @@ else if(USE_ACCOUNT_NAME) $account_logged->find($login_account); else - $account_logged->load($login_account); - + $account_logged->load($login_account, true); + $config_salt_enabled = $db->hasColumn('accounts', 'salt'); if($account_logged->isLoaded() && encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $login_password) == $account_logged->getPassword() && (!isset($t) || $t['attempts'] < 5) diff --git a/system/pages/createaccount.php b/system/pages/createaccount.php index d11804fb..d75690f4 100644 --- a/system/pages/createaccount.php +++ b/system/pages/createaccount.php @@ -184,6 +184,14 @@ if($save) } else { + if($config['account_create_auto_login']) { + $_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id; + $_POST['password_login'] = $password2; + + require SYSTEM . 'login.php'; + header('Location: ' . getLink('account/manage')); + } + $twig->display('account.created.html.twig', array( 'account' => $tmp_account ));