File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
services/web/server/src/simcore_service_webserver/login_accounts Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 22from typing import Any
33
44from aiohttp import web
5+ from common_library .user_messages import user_message
56from models_library .api_schemas_webserver .auth import (
67 AccountRequestInfo ,
78 UnregisterCheck ,
89)
910from servicelib .aiohttp import status
1011from servicelib .aiohttp .application_keys import APP_FIRE_AND_FORGET_TASKS_KEY
11- from servicelib .aiohttp .requests_validation import parse_request_body_as
12+ from servicelib .aiohttp .requests_validation import (
13+ handle_validation_as_http_error ,
14+ parse_request_body_as ,
15+ )
1216from servicelib .logging_utils import get_log_record_extra , log_context
1317from servicelib .utils import fire_and_forget_task
1418
@@ -88,10 +92,17 @@ async def request_product_account(request: web.Request):
8892 raise web .HTTPUnprocessableEntity (text = MSG_WRONG_CAPTCHA__INVALID )
8993 session .pop (CAPTCHA_SESSION_KEY , None )
9094
91- # create pre-regiatration or raise if already exists
95+ with handle_validation_as_http_error (
96+ error_msg_template = user_message (
97+ "Found an error in the request form: '{failed}'"
98+ ),
99+ resource_name = request .rel_url .path ,
100+ ):
101+ profile = UserAccountRestPreRegister .model_validate (body .form )
102+
92103 await _service .create_pre_registration (
93104 request .app ,
94- profile = UserAccountRestPreRegister . model_validate ( body . form ) ,
105+ profile = profile ,
95106 product_name = product .name ,
96107 )
97108
You can’t perform that action at this time.
0 commit comments