Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
| 2 | require_once("core.php"); |
| 3 | |
| 4 | if (!$conf["enableRecovery"] || !$conf["mail"]["enabled"]) security::notFound(); |
| 5 | |
| 6 | if (!security::checkParams("POST", [ |
| 7 | ["email", security::PARAM_ISEMAIL], |
| 8 | ["dni", security::PARAM_NEMPTY] |
| 9 | ])) { |
| 10 | security::go("index.php?msg=unexpected"); |
| 11 | } |
| 12 | |
| 13 | $email = $_POST["email"]; |
| 14 | $dni = $_POST["dni"]; |
| 15 | |
| 16 | $user = recovery::getUser($email, $dni); |
| 17 | if ($user === false) { |
| 18 | sleep(3); |
| 19 | security::go("index.php?msg=recovery"); |
| 20 | } |
| 21 | |
| 22 | security::go("index.php?msg=".(recovery::recover($user) ? "recovery" : "unexpected")); |