Ajoute les mises à jour autonomes

Les installations hors YunoHost peuvent désormais vérifier et installer une release Forgejo avec sauvegarde et retour arrière complet.
This commit is contained in:
Alexandre NOEL 2026-09-08 20:13:55 +02:00
commit 53e79a72d7
25 changed files with 1146 additions and 61 deletions

View file

@ -168,6 +168,17 @@ final class Auth
{
return (self::user()['role'] ?? '') === $role;
}
public static function verifyCurrentPassword(string $password): bool
{
$id = self::id();
if (!$id || $password === '') {
return false;
}
$stmt = DB::pdo()->prepare('SELECT password_hash FROM users WHERE id=:id AND active=1');
$stmt->execute([':id' => $id]);
$hash = $stmt->fetchColumn();
return is_string($hash) && password_verify($password, $hash);
}
public static function canWrite(string $path): bool
{
$module = PermissionService::moduleForPath($path);