Confirm Register

This commit is contained in:
2024-07-22 13:49:33 +02:00
parent 06ce614c2b
commit 2fde820942
5 changed files with 115 additions and 5 deletions
+17
View File
@@ -30,4 +30,21 @@ class Register extends Api
}
}
}
public function patch(): void
{
$code = Input::post("code");
if (empty($code)) throw new Exception("Missing code", 400);
try {
Response::json(User::confirm($code));
} catch (Exception $err) {
switch ($err->getMessage()) {
case "NotFound":
throw new Exception("User not found", 404);
default:
throw $err;
}
}
}
}