(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

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