Confirm Register
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user