66
77from typing import Any
88
9- from _common import EnvelopeE
109from fastapi import APIRouter , status
1110from models_library .api_schemas_webserver .auth import (
1211 AccountRequestInfo ,
1514 UnregisterCheck ,
1615)
1716from models_library .generics import Envelope
18- from models_library .rest_error import ErrorGet , Log
17+ from models_library .rest_error import EnvelopedError , Log
1918from pydantic import BaseModel , Field , confloat
2019from simcore_service_webserver ._meta import API_VTAG
2120from simcore_service_webserver .login ._2fa_handlers import Resend2faBody
@@ -76,7 +75,7 @@ async def register(_body: RegisterBody):
7675 "/auth/unregister" ,
7776 response_model = Envelope [Log ],
7877 status_code = status .HTTP_200_OK ,
79- responses = {status .HTTP_409_CONFLICT : {"model" : EnvelopeE [ ErrorGet ] }},
78+ responses = {status .HTTP_409_CONFLICT : {"model" : EnvelopedError }},
8079)
8180async def unregister_account (_body : UnregisterCheck ):
8281 ...
@@ -108,7 +107,7 @@ async def phone_confirmation(_body: PhoneConfirmationBody):
108107 responses = {
109108 # status.HTTP_503_SERVICE_UNAVAILABLE
110109 status .HTTP_401_UNAUTHORIZED : {
111- "model" : EnvelopeE [ ErrorGet ] ,
110+ "model" : EnvelopedError ,
112111 "description" : "unauthorized reset due to invalid token code" ,
113112 }
114113 },
@@ -123,7 +122,7 @@ async def login(_body: LoginBody):
123122 operation_id = "auth_login_2fa" ,
124123 responses = {
125124 status .HTTP_401_UNAUTHORIZED : {
126- "model" : EnvelopeE [ ErrorGet ] ,
125+ "model" : EnvelopedError ,
127126 "description" : "unauthorized reset due to invalid token code" ,
128127 }
129128 },
@@ -138,7 +137,7 @@ async def login_2fa(_body: LoginTwoFactorAuthBody):
138137 operation_id = "auth_resend_2fa_code" ,
139138 responses = {
140139 status .HTTP_401_UNAUTHORIZED : {
141- "model" : EnvelopeE [ ErrorGet ] ,
140+ "model" : EnvelopedError ,
142141 "description" : "unauthorized reset due to invalid token code" ,
143142 }
144143 },
@@ -162,7 +161,7 @@ async def logout(_body: LogoutBody):
162161 status_code = status .HTTP_204_NO_CONTENT ,
163162 responses = {
164163 status .HTTP_401_UNAUTHORIZED : {
165- "model" : EnvelopeE [ ErrorGet ] ,
164+ "model" : EnvelopedError ,
166165 "description" : "unauthorized reset due to invalid token code" ,
167166 }
168167 },
@@ -175,7 +174,7 @@ async def check_auth():
175174 "/auth/reset-password" ,
176175 response_model = Envelope [Log ],
177176 operation_id = "auth_reset_password" ,
178- responses = {status .HTTP_503_SERVICE_UNAVAILABLE : {"model" : EnvelopeE [ ErrorGet ] }},
177+ responses = {status .HTTP_503_SERVICE_UNAVAILABLE : {"model" : EnvelopedError }},
179178)
180179async def reset_password (_body : ResetPasswordBody ):
181180 """a non logged-in user requests a password reset"""
@@ -187,7 +186,7 @@ async def reset_password(_body: ResetPasswordBody):
187186 operation_id = "auth_reset_password_allowed" ,
188187 responses = {
189188 status .HTTP_401_UNAUTHORIZED : {
190- "model" : EnvelopeE [ ErrorGet ] ,
189+ "model" : EnvelopedError ,
191190 "description" : "unauthorized reset due to invalid token code" ,
192191 }
193192 },
@@ -202,11 +201,11 @@ async def reset_password_allowed(code: str, _body: ResetPasswordConfirmation):
202201 operation_id = "auth_change_email" ,
203202 responses = {
204203 status .HTTP_401_UNAUTHORIZED : {
205- "model" : EnvelopeE [ ErrorGet ] ,
204+ "model" : EnvelopedError ,
206205 "description" : "unauthorized user. Login required" ,
207206 },
208207 status .HTTP_503_SERVICE_UNAVAILABLE : {
209- "model" : EnvelopeE [ ErrorGet ] ,
208+ "model" : EnvelopedError ,
210209 "description" : "unable to send confirmation email" ,
211210 },
212211 },
@@ -234,15 +233,15 @@ class PasswordCheckSchema(BaseModel):
234233 operation_id = "auth_change_password" ,
235234 responses = {
236235 status .HTTP_401_UNAUTHORIZED : {
237- "model" : EnvelopeE [ ErrorGet ] ,
236+ "model" : EnvelopedError ,
238237 "description" : "unauthorized user. Login required" ,
239238 },
240239 status .HTTP_409_CONFLICT : {
241- "model" : EnvelopeE [ ErrorGet ] ,
240+ "model" : EnvelopedError ,
242241 "description" : "mismatch between new and confirmation passwords" ,
243242 },
244243 status .HTTP_422_UNPROCESSABLE_ENTITY : {
245- "model" : EnvelopeE [ ErrorGet ] ,
244+ "model" : EnvelopedError ,
246245 "description" : "current password is invalid" ,
247246 },
248247 },
0 commit comments