@@ -56,6 +56,20 @@ def _get_ipinfo(request: web.Request) -> dict[str, Any]:
5656routes = web .RouteTableDef ()
5757
5858
59+ @routes .get (f"/{ API_VTAG } /auth/captcha" , name = "create_captcha" )
60+ @global_rate_limit_route (number_of_requests = 30 , interval_seconds = MINUTE )
61+ @handle_rest_requests_exceptions
62+ async def create_captcha (request : web .Request ):
63+ session = await session_service .get_session (request )
64+
65+ captcha_text , image_data = await _preregistration_service .create_captcha ()
66+
67+ # Store captcha text in session
68+ session [CAPTCHA_SESSION_KEY ] = captcha_text
69+
70+ return web .Response (body = image_data , content_type = "image/png" )
71+
72+
5973@routes .post (
6074 f"/{ API_VTAG } /auth/request-account" ,
6175 name = "request_product_account" ,
@@ -147,17 +161,3 @@ async def unregister_account(request: web.Request):
147161 )
148162
149163 return response
150-
151-
152- @routes .get (f"/{ API_VTAG } /auth/captcha" , name = "create_captcha" )
153- @global_rate_limit_route (number_of_requests = 30 , interval_seconds = MINUTE )
154- @handle_rest_requests_exceptions
155- async def create_captcha (request : web .Request ):
156- session = await session_service .get_session (request )
157-
158- captcha_text , image_data = await _preregistration_service .create_captcha ()
159-
160- # Store captcha text in session
161- session [CAPTCHA_SESSION_KEY ] = captcha_text
162-
163- return web .Response (body = image_data , content_type = "image/png" )
0 commit comments