hash poster passwords

This commit is contained in:
fowr 2024-06-20 10:11:47 -03:00 committed by Zankaria
parent c7bb61f2ff
commit 8b2f002582
6 changed files with 33 additions and 5 deletions

View file

@ -530,10 +530,12 @@ function handle_delete(Context $ctx)
$password = &$_POST['password'];
if ($password == '') {
if (empty($password)) {
error($config['error']['invalidpassword']);
}
$password = hashPassword($_POST['password']);
$delete = [];
foreach ($_POST as $post => $value) {
if (preg_match('/^delete_(\d+)$/', $post, $m)) {
@ -1013,7 +1015,7 @@ function handle_post(Context $ctx)
$post['subject'] = $_POST['subject'];
$post['email'] = str_replace(' ', '%20', htmlspecialchars($_POST['email']));
$post['body'] = $_POST['body'];
$post['password'] = $_POST['password'];
$post['password'] = hashPassword($_POST['password']);
$post['has_file'] = (!isset($post['embed']) && (($post['op'] && !isset($post['no_longer_require_an_image_for_op']) && $config['force_image_op']) || count($_FILES) > 0));
if (!$dropped_post) {
@ -1204,9 +1206,6 @@ function handle_post(Context $ctx)
error($config['error']['toolong_body']);
}
}
if (mb_strlen($post['password']) > 20) {
error(sprintf($config['error']['toolong'], 'password'));
}
}
wordfilters($post['body']);