- lastheard 24h: client-side paginering (lib/pager.js), dynamisk sidstorlek - lastheard: separat live-feed (lastheard_live_view.js), 24h loggar varje key-up - listen_view.js + auth/admin_listen.*: Listen Live - genomgående UI/auth-uppdateringar synkade från dev Inga hårdkodade secrets/IP/login — endast hostnamn.
22 lines
671 B
PHP
22 lines
671 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
require __DIR__ . '/lib.php';
|
|
|
|
$uuid = require_login();
|
|
csrf_check();
|
|
$j = json_in();
|
|
$old = (string)($j['old_password'] ?? '');
|
|
$new = (string)($j['new_password'] ?? '');
|
|
|
|
if ($old === '' || $new === '') json_out(['ok'=>false,'error'=>'missing_fields'], 400);
|
|
if (strlen($new) < 6) json_out(['ok'=>false,'error'=>'too_short'], 400);
|
|
|
|
$acct = acct_get($uuid);
|
|
$hash = (string)($acct['password_hash'] ?? '');
|
|
if ($hash === '' || !password_verify($old, $hash)) {
|
|
json_out(['ok'=>false,'error'=>'invalid_old_password'], 401);
|
|
}
|
|
|
|
redis()->hSet(acct_key($uuid), 'password_hash', password_hash($new, PASSWORD_DEFAULT));
|
|
json_out(['ok'=>true]);
|