66
77from typing import Any
88
9- from _common import Error , Log
9+ from _common import EnvelopeE
1010from fastapi import APIRouter , status
1111from models_library .api_schemas_webserver .auth import (
1212 AccountRequestInfo ,
1515 UnregisterCheck ,
1616)
1717from models_library .generics import Envelope
18+ from models_library .rest_error import ErrorGet , Log
1819from pydantic import BaseModel , Field , confloat
1920from simcore_service_webserver ._meta import API_VTAG
2021from simcore_service_webserver .login ._2fa_handlers import Resend2faBody
@@ -75,7 +76,7 @@ async def register(_body: RegisterBody):
7576 "/auth/unregister" ,
7677 response_model = Envelope [Log ],
7778 status_code = status .HTTP_200_OK ,
78- responses = {status .HTTP_409_CONFLICT : {"model" : Envelope [ Error ]}},
79+ responses = {status .HTTP_409_CONFLICT : {"model" : EnvelopeE [ ErrorGet ]}},
7980)
8081async def unregister_account (_body : UnregisterCheck ):
8182 ...
@@ -107,7 +108,7 @@ async def phone_confirmation(_body: PhoneConfirmationBody):
107108 responses = {
108109 # status.HTTP_503_SERVICE_UNAVAILABLE
109110 status .HTTP_401_UNAUTHORIZED : {
110- "model" : Envelope [ Error ],
111+ "model" : EnvelopeE [ ErrorGet ],
111112 "description" : "unauthorized reset due to invalid token code" ,
112113 }
113114 },
@@ -122,7 +123,7 @@ async def login(_body: LoginBody):
122123 operation_id = "auth_login_2fa" ,
123124 responses = {
124125 status .HTTP_401_UNAUTHORIZED : {
125- "model" : Envelope [ Error ],
126+ "model" : EnvelopeE [ ErrorGet ],
126127 "description" : "unauthorized reset due to invalid token code" ,
127128 }
128129 },
@@ -137,7 +138,7 @@ async def login_2fa(_body: LoginTwoFactorAuthBody):
137138 operation_id = "auth_resend_2fa_code" ,
138139 responses = {
139140 status .HTTP_401_UNAUTHORIZED : {
140- "model" : Envelope [ Error ],
141+ "model" : EnvelopeE [ ErrorGet ],
141142 "description" : "unauthorized reset due to invalid token code" ,
142143 }
143144 },
@@ -161,7 +162,7 @@ async def logout(_body: LogoutBody):
161162 status_code = status .HTTP_204_NO_CONTENT ,
162163 responses = {
163164 status .HTTP_401_UNAUTHORIZED : {
164- "model" : Envelope [ Error ],
165+ "model" : EnvelopeE [ ErrorGet ],
165166 "description" : "unauthorized reset due to invalid token code" ,
166167 }
167168 },
@@ -174,7 +175,7 @@ async def check_auth():
174175 "/auth/reset-password" ,
175176 response_model = Envelope [Log ],
176177 operation_id = "auth_reset_password" ,
177- responses = {status .HTTP_503_SERVICE_UNAVAILABLE : {"model" : Envelope [ Error ]}},
178+ responses = {status .HTTP_503_SERVICE_UNAVAILABLE : {"model" : EnvelopeE [ ErrorGet ]}},
178179)
179180async def reset_password (_body : ResetPasswordBody ):
180181 """a non logged-in user requests a password reset"""
@@ -186,7 +187,7 @@ async def reset_password(_body: ResetPasswordBody):
186187 operation_id = "auth_reset_password_allowed" ,
187188 responses = {
188189 status .HTTP_401_UNAUTHORIZED : {
189- "model" : Envelope [ Error ],
190+ "model" : EnvelopeE [ ErrorGet ],
190191 "description" : "unauthorized reset due to invalid token code" ,
191192 }
192193 },
@@ -201,11 +202,11 @@ async def reset_password_allowed(code: str, _body: ResetPasswordConfirmation):
201202 operation_id = "auth_change_email" ,
202203 responses = {
203204 status .HTTP_401_UNAUTHORIZED : {
204- "model" : Envelope [ Error ],
205+ "model" : EnvelopeE [ ErrorGet ],
205206 "description" : "unauthorized user. Login required" ,
206207 },
207208 status .HTTP_503_SERVICE_UNAVAILABLE : {
208- "model" : Envelope [ Error ],
209+ "model" : EnvelopeE [ ErrorGet ],
209210 "description" : "unable to send confirmation email" ,
210211 },
211212 },
@@ -233,15 +234,15 @@ class PasswordCheckSchema(BaseModel):
233234 operation_id = "auth_change_password" ,
234235 responses = {
235236 status .HTTP_401_UNAUTHORIZED : {
236- "model" : Envelope [ Error ],
237+ "model" : EnvelopeE [ ErrorGet ],
237238 "description" : "unauthorized user. Login required" ,
238239 },
239240 status .HTTP_409_CONFLICT : {
240- "model" : Envelope [ Error ],
241+ "model" : EnvelopeE [ ErrorGet ],
241242 "description" : "mismatch between new and confirmation passwords" ,
242243 },
243244 status .HTTP_422_UNPROCESSABLE_ENTITY : {
244- "model" : Envelope [ Error ],
245+ "model" : EnvelopeE [ ErrorGet ],
245246 "description" : "current password is invalid" ,
246247 },
247248 },
0 commit comments