File tree Expand file tree Collapse file tree 8 files changed +20
-29
lines changed
src/simcore_service_webserver
tests/unit/with_dbs/03/login Expand file tree Collapse file tree 8 files changed +20
-29
lines changed Original file line number Diff line number Diff line change 11from typing import Final
22
33MSG_2FA_CODE_SENT : Final [str ] = "A code was sent by SMS to {phone_number}."
4- MSG_2FA_UNAVAILABLE_OEC : Final [str ] = (
5- "Two-factor authentication is temporarily unavailable. Please try again later. ({error_code})"
6- )
4+ MSG_2FA_UNAVAILABLE : Final [str ] = "Two-factor authentication is temporarily unavailable"
75MSG_ACTIVATED : Final [str ] = "Your account has been activated."
86MSG_ACTIVATION_REQUIRED : Final [str ] = (
97 "Please activate your account via the email we sent before logging in."
Original file line number Diff line number Diff line change 1- """ Core functionality and tools for user's registration
1+ """Core functionality and tools for user's registration
22
3- - registration code
4- - invitation code
3+ - registration code
4+ - invitation code
55"""
66
77import logging
@@ -214,9 +214,7 @@ def _invitations_request_context(invitation_code: str) -> Iterator[URL]:
214214
215215 except (ValidationError , InvalidInvitationError ) as err :
216216 error_code = create_error_code (err )
217- user_error_msg = (
218- f"Invalid invitation. { MSG_INVITATIONS_CONTACT_SUFFIX } [{ error_code } ]"
219- )
217+ user_error_msg = f"Invalid invitation. { MSG_INVITATIONS_CONTACT_SUFFIX } "
220218
221219 _logger .exception (
222220 ** create_troubleshotting_log_kwargs (
@@ -233,7 +231,7 @@ def _invitations_request_context(invitation_code: str) -> Iterator[URL]:
233231
234232 except InvitationsServiceUnavailableError as err :
235233 error_code = create_error_code (err )
236- user_error_msg = f "Unable to process your invitation since the invitations service is currently unavailable [ { error_code } ] "
234+ user_error_msg = "Unable to process your invitation since the invitations service is currently unavailable"
237235
238236 _logger .exception (
239237 ** create_troubleshotting_log_kwargs (
Original file line number Diff line number Diff line change 77from servicelib .mimetype_constants import MIMETYPE_APPLICATION_JSON
88
99from ..errors import WebServerBaseError
10- from ._constants import MSG_2FA_UNAVAILABLE_OEC
10+ from ._constants import MSG_2FA_UNAVAILABLE
1111
1212_logger = logging .getLogger (__name__ )
1313
1414
15- class LoginError (WebServerBaseError , ValueError ):
16- ...
15+ class LoginError (WebServerBaseError , ValueError ): ...
1716
1817
1918class SendingVerificationSmsError (LoginError ):
@@ -32,7 +31,7 @@ async def wrapper(request: web.Request) -> web.StreamResponse:
3231
3332 except (SendingVerificationSmsError , SendingVerificationEmailError ) as exc :
3433 error_code = exc .error_code ()
35- front_end_msg = MSG_2FA_UNAVAILABLE_OEC . format ( error_code = error_code )
34+ front_end_msg = MSG_2FA_UNAVAILABLE
3635 # in these cases I want to log the cause
3736 _logger .exception (
3837 ** create_troubleshotting_log_kwargs (
Original file line number Diff line number Diff line change @@ -187,8 +187,7 @@ async def validate_confirmation_and_redirect(request: web.Request):
187187 error_code = create_error_code (err )
188188 user_error_msg = (
189189 f"Sorry, we cannot confirm your { action } ."
190- "Please try again in a few moments. "
191- f"If the problem persist please contact support attaching this code ({ error_code } )"
190+ "Please try again in a few moments."
192191 )
193192
194193 _logger .exception (
Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ async def register(request: web.Request):
274274 )
275275 except Exception as err : # pylint: disable=broad-except
276276 error_code = create_error_code (err )
277- user_error_msg = f" { MSG_CANT_SEND_MAIL } [ { error_code } ]"
277+ user_error_msg = MSG_CANT_SEND_MAIL
278278
279279 _logger .exception (
280280 ** create_troubleshotting_log_kwargs (
@@ -416,7 +416,7 @@ async def register_phone(request: web.Request):
416416 except Exception as err : # pylint: disable=broad-except
417417 # Unhandled errors -> 503
418418 error_code = create_error_code (err )
419- user_error_msg = f "Currently we cannot register phone numbers [ { error_code } ] "
419+ user_error_msg = "Currently we cannot register phone numbers"
420420
421421 _logger .exception (
422422 ** create_troubleshotting_log_kwargs (
Original file line number Diff line number Diff line change 5959 MissingGroupExtraPropertiesForProductError : HttpErrorInfo (
6060 status .HTTP_503_SERVICE_UNAVAILABLE ,
6161 "The product is not ready for use until the configuration is fully completed. "
62- "Please wait and try again. "
63- "If this issue persists, contact support indicating this support code: {error_code}." ,
62+ "Please wait and try again. " ,
6463 ),
6564}
6665
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ async def wrapper(request: web.Request) -> web.StreamResponse:
9797 except BillingDetailsNotFoundError as exc :
9898
9999 error_code = create_error_code (exc )
100- user_error_msg = f" { MSG_BILLING_DETAILS_NOT_DEFINED_ERROR } [ { error_code } ]"
100+ user_error_msg = MSG_BILLING_DETAILS_NOT_DEFINED_ERROR
101101
102102 _logger .exception (
103103 ** create_troubleshotting_log_kwargs (
@@ -155,10 +155,10 @@ async def create_wallet(request: web.Request):
155155async def list_wallets (request : web .Request ):
156156 req_ctx = WalletsRequestContext .model_validate (request )
157157
158- wallets : list [
159- WalletGetWithAvailableCredits
160- ] = await _api . list_wallets_with_available_credits_for_user (
161- app = request . app , user_id = req_ctx . user_id , product_name = req_ctx . product_name
158+ wallets : list [WalletGetWithAvailableCredits ] = (
159+ await _api . list_wallets_with_available_credits_for_user (
160+ app = request . app , user_id = req_ctx . user_id , product_name = req_ctx . product_name
161+ )
162162 )
163163
164164 return envelope_json_response (wallets )
Original file line number Diff line number Diff line change 3232)
3333from simcore_service_webserver .login ._constants import (
3434 CODE_2FA_SMS_CODE_REQUIRED ,
35- MSG_2FA_UNAVAILABLE_OEC ,
35+ MSG_2FA_UNAVAILABLE ,
3636)
3737from simcore_service_webserver .login .storage import AsyncpgStorage
3838from simcore_service_webserver .products import products_web
@@ -456,9 +456,7 @@ async def test_2fa_sms_failure_during_login(
456456 response , status .HTTP_503_SERVICE_UNAVAILABLE
457457 )
458458 assert not data
459- assert error ["errors" ][0 ]["message" ].startswith (
460- MSG_2FA_UNAVAILABLE_OEC [:10 ]
461- )
459+ assert error ["errors" ][0 ]["message" ].startswith (MSG_2FA_UNAVAILABLE [:10 ])
462460
463461 # Expects logs like 'Failed while setting up 2FA code and sending SMS to 157XXXXXXXX3 [OEC:140392495277888]'
464462 assert f"{ fake_user_phone_number [:3 ]} " in caplog .text
You can’t perform that action at this time.
0 commit comments