<?php
require __DIR__.'/_bootstrap.php';
use Zoo\Database;
use Zoo\Auth\PasswordResetService;
try{
    $in=input_json();
    $r=(new PasswordResetService(Database::connect()))->request((string)($in['phone']??''));
    json_out(['ok'=>true,'reset'=>$r]);
}catch(Throwable $e){
    json_out(['ok'=>false,'error'=>$e->getMessage()],422);
}
