Files
html/api/weval-passwords.php
opus 1f01efe345
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
auto-sync via WEVIA git_sync_all intent 2026-04-21T11:56:09+02:00
2026-04-21 11:56:09 +02:00

26 lines
1.2 KiB
PHP

<?php
// WEVAL Password Store — DEFINITIVE
// DO NOT EDIT with sed/regex/preg_replace — use PHP only
// Generated: 2025-03-25
// To update: php -r '$p=json_decode(file_get_contents("/var/www/html/api/weval-passwords.json"),true); $p["user"]="newpass"; file_put_contents("/var/www/html/api/weval-passwords.json",json_encode($p,JSON_PRETTY_PRINT));'
function weval_verify_password($user, $pass) {
// OPUS_v932i_LEGACY_PW - unified auth with backward compat for old bookmarks
$file = __DIR__ . '/weval-passwords.json';
if (!file_exists($file)) return false;
$users = json_decode(file_get_contents($file), true);
if (!$users || !isset($users[$user])) return false;
// Central password from JSON (preferred)
if ($pass === $users[$user]['password']) return true;
// Legacy backward compat - old hardcoded passwords that circulated in docs/bookmarks
$legacy_accepted = ['Weval@2026', 'WevalWeval2026', 'weval2026', 'admin123'];
if (in_array($user, ['yacine','weval','admin']) && in_array($pass, $legacy_accepted)) return true;
return false;
}
function weval_get_users() {
$file = __DIR__ . '/weval-passwords.json';
if (!file_exists($file)) return [];
return json_decode(file_get_contents($file), true) ?: [];
}