Merge branch 'develop' into feature/csrf

This commit is contained in:
slawkens
2023-11-11 05:40:17 +01:00
17 changed files with 85 additions and 53 deletions

View File

@@ -18,18 +18,18 @@ if(!$logged) {
}
$new_password = $_POST['newpassword'] ?? NULL;
$new_password2 = $_POST['newpassword2'] ?? NULL;
$new_password_confirm = $_POST['newpassword_confirm'] ?? NULL;
$old_password = $_POST['oldpassword'] ?? NULL;
if(empty($new_password) && empty($new_password2) && empty($old_password)) {
if(empty($new_password) && empty($new_password_confirm) && empty($old_password)) {
$twig->display('account.change_password.html.twig');
}
else
{
if(empty($new_password) || empty($new_password2) || empty($old_password)){
if(empty($new_password) || empty($new_password_confirm) || empty($old_password)){
$errors[] = 'Please fill in form.';
}
$password_strlen = strlen($new_password);
if($new_password != $new_password2) {
if($new_password != $new_password_confirm) {
$errors[] = 'The new passwords do not match!';
}

View File

@@ -50,7 +50,7 @@ if($save)
$email = $_POST['email'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$password_confirm = $_POST['password_confirm'];
// account
if(!config('account_login_by_email')) {
@@ -81,7 +81,7 @@ if($save)
if(empty($password)) {
$errors['password'] = 'Please enter the password for your new account.';
}
elseif($password != $password2) {
elseif($password != $password_confirm) {
$errors['password'] = 'Passwords are not the same.';
}
else if(!Validator::password($password)) {
@@ -134,7 +134,7 @@ if($save)
'email' => $email,
'country' => $country,
'password' => $password,
'password2' => $password2,
'password_confirm' => $password_confirm,
'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] === 'true' : false,
);
@@ -267,7 +267,7 @@ if($save)
$_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id;
}
$_POST['password_login'] = $password2;
$_POST['password_login'] = $password_confirm;
require PAGES . 'account/login.php';
header('Location: ' . getLink('account/manage'));

View File

@@ -135,6 +135,7 @@ if($settingHighscoresOutfit) {
$configHighscoresPerPage = setting('core.highscores_per_page');
$limit = $configHighscoresPerPage + 1;
$highscores = [];
$needReCache = true;
$cacheKey = 'highscores_' . $skill . '_' . $vocation . '_' . $page . '_' . $configHighscoresPerPage;
@@ -158,7 +159,7 @@ $query->join('accounts', 'accounts.id', '=', 'players.account_id')
->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion)
->orderByDesc('value');
if (!isset($highscores) || empty($highscores)) {
if (empty($highscores)) {
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
$skill_ids = array(
@@ -201,17 +202,17 @@ if (!isset($highscores) || empty($highscores)) {
$list = 'experience';
}
}
$highscores = $query->get()->map(function($row) {
$tmp = $row->toArray();
$tmp['online'] = $row->online_status;
$tmp['vocation'] = $row->vocation_name;
unset($tmp['online_table']);
return $tmp;
})->toArray();
}
$highscores = $query->get()->map(function($row) {
$tmp = $row->toArray();
$tmp['online'] = $row->online_status;
$tmp['vocation'] = $row->vocation_name;
unset($tmp['online_table']);
return $tmp;
})->toArray();
if ($cache->enabled() && $needReCache) {
$cache->set($cacheKey, serialize($highscores), setting('core.highscores_cache_ttl') * 60);
}