(configurable) auto login after registration

This commit is contained in:
slawkens 2019-03-19 11:17:15 +01:00
parent 09b6f16a51
commit 862b58c176
4 changed files with 14 additions and 4 deletions

1
TODO
View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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
));