Project import generated by Copybara.

GitOrigin-RevId: 63746295f1a5ab5a619056791995793d65529e62
diff --git a/src/dostartrecovery.php b/src/dostartrecovery.php
new file mode 100644
index 0000000..b7060bc
--- /dev/null
+++ b/src/dostartrecovery.php
@@ -0,0 +1,22 @@
+<?php
+require_once("core.php");
+
+if (!$conf["enableRecovery"] || !$conf["mail"]["enabled"]) security::notFound();
+
+if (!security::checkParams("POST", [
+  ["email", security::PARAM_ISEMAIL],
+  ["dni", security::PARAM_NEMPTY]
+])) {
+  security::go("index.php?msg=unexpected");
+}
+
+$email = $_POST["email"];
+$dni = $_POST["dni"];
+
+$user = recovery::getUser($email, $dni);
+if ($user === false) {
+  sleep(3);
+  security::go("index.php?msg=recovery");
+}
+
+security::go("index.php?msg=".(recovery::recover($user) ? "recovery" : "unexpected"));