Files
reflector-dashboard/auth/password_change.php
T
bjorneandClaude Fable 5.1 25b481e2ae Public web-only release: SvxPortal front-end + auth backend, install templates and INSTALL.md
Stripped from the internal repo: per-box deploy trees, Go services (nodelist/astmeta/proxy/svxdr),
deploy/sync scripts and all secrets. Config templates for nginx, PHP-FPM, Redis and tmpfiles
live in install/ with CHANGEME placeholders.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 23:07:05 +02:00

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