Skip to content

Commit cd9185b

Browse files
committed
cleanup
1 parent 6903354 commit cd9185b

File tree

1 file changed

+44
-32
lines changed
  • services/web/server/src/simcore_service_webserver/login

1 file changed

+44
-32
lines changed

services/web/server/src/simcore_service_webserver/login/_constants.py

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,90 @@
11
from typing import Final
22

3-
MSG_2FA_CODE_SENT: Final[str] = "A code was sent by SMS to {phone_number}."
4-
MSG_2FA_UNAVAILABLE: Final[str] = "Two-factor authentication is temporarily unavailable"
5-
MSG_ACTIVATED: Final[str] = "Your account has been activated."
6-
MSG_ACTIVATION_REQUIRED: Final[str] = (
3+
from common_library.user_messages import user_message
4+
5+
MSG_2FA_CODE_SENT: Final[str] = user_message(
6+
"A code was sent by SMS to {phone_number}."
7+
)
8+
MSG_2FA_UNAVAILABLE: Final[str] = user_message(
9+
"Two-factor authentication is temporarily unavailable"
10+
)
11+
MSG_ACTIVATED: Final[str] = user_message("Your account has been activated.")
12+
MSG_ACTIVATION_REQUIRED: Final[str] = user_message(
713
"Please activate your account via the email we sent before logging in."
814
)
9-
MSG_AUTH_FAILED: Final[str] = (
15+
MSG_AUTH_FAILED: Final[str] = user_message(
1016
"Authorization was not successful. Please check your credentials and try again."
1117
)
12-
MSG_CANT_SEND_MAIL: Final[str] = (
18+
MSG_CANT_SEND_MAIL: Final[str] = user_message(
1319
"Unable to send email at this time. Please try again later."
1420
)
15-
MSG_CHANGE_EMAIL_REQUESTED: Final[str] = (
21+
MSG_CHANGE_EMAIL_REQUESTED: Final[str] = user_message(
1622
"Please click the verification link sent to your new email address."
1723
)
18-
MSG_EMAIL_CHANGED: Final[str] = "Your email address has been updated."
19-
MSG_EMAIL_ALREADY_REGISTERED: Final[str] = (
24+
MSG_EMAIL_CHANGED: Final[str] = user_message("Your email address has been updated.")
25+
MSG_EMAIL_ALREADY_REGISTERED: Final[str] = user_message(
2026
"This email address is already registered. Try logging in or use a different address."
2127
)
22-
MSG_EMAIL_SENT: Final[str] = "An email was sent to {email} with further instructions."
23-
MSG_LOGGED_IN: Final[str] = "You have successfully logged in."
24-
MSG_LOGGED_OUT: Final[str] = "You have successfully logged out."
25-
MSG_OFTEN_RESET_PASSWORD: Final[str] = (
28+
MSG_EMAIL_SENT: Final[str] = user_message(
29+
"An email was sent to {email} with further instructions."
30+
)
31+
MSG_LOGGED_IN: Final[str] = user_message("You have successfully logged in.")
32+
MSG_LOGGED_OUT: Final[str] = user_message("You have successfully logged out.")
33+
MSG_OFTEN_RESET_PASSWORD: Final[str] = user_message(
2634
"You've requested a password reset recently. Please use the link we sent you or wait before requesting again."
2735
)
28-
MSG_PASSWORD_CHANGE_NOT_ALLOWED: Final[str] = (
36+
MSG_PASSWORD_CHANGE_NOT_ALLOWED: Final[str] = user_message(
2937
"Unable to reset password. Permissions may have expired or been removed. "
3038
"Please try again, or contact support if the problem continues: {support_email}"
3139
)
32-
MSG_PASSWORD_CHANGED: Final[str] = "Your password has been updated."
33-
MSG_PASSWORD_MISMATCH: Final[str] = (
40+
MSG_PASSWORD_CHANGED: Final[str] = user_message("Your password has been updated.")
41+
MSG_PASSWORD_MISMATCH: Final[str] = user_message(
3442
"Password and confirmation do not match. Please try again."
3543
)
36-
MSG_PHONE_MISSING: Final[str] = "No phone number is associated with this account."
37-
MSG_UNAUTHORIZED_CODE_RESEND_2FA: Final[str] = (
44+
MSG_PHONE_MISSING: Final[str] = user_message(
45+
"No phone number is associated with this account."
46+
)
47+
MSG_UNAUTHORIZED_CODE_RESEND_2FA: Final[str] = user_message(
3848
"You can no longer resend the code. Please restart the verification process."
3949
)
40-
MSG_UNAUTHORIZED_LOGIN_2FA: Final[str] = (
50+
MSG_UNAUTHORIZED_LOGIN_2FA: Final[str] = user_message(
4151
"You can no longer submit a code. Please restart the login process."
4252
)
43-
MSG_UNAUTHORIZED_REGISTER_PHONE: Final[str] = (
53+
MSG_UNAUTHORIZED_REGISTER_PHONE: Final[str] = user_message(
4454
"Phone registration is no longer allowed. Please restart the registration process."
4555
)
46-
MSG_UNAUTHORIZED_PHONE_CONFIRMATION: Final[str] = (
56+
MSG_UNAUTHORIZED_PHONE_CONFIRMATION: Final[str] = user_message(
4757
"You can no longer submit a code. Please restart the confirmation process."
4858
)
49-
MSG_UNKNOWN_EMAIL: Final[str] = "This email address is not registered."
50-
MSG_USER_DELETED: Final[str] = (
59+
MSG_UNKNOWN_EMAIL: Final[str] = user_message("This email address is not registered.")
60+
MSG_USER_DELETED: Final[str] = user_message(
5161
"This account is scheduled for deletion. To reactivate it or for more information, please contact support: {support_email}"
5262
)
53-
MSG_USER_BANNED: Final[str] = (
63+
MSG_USER_BANNED: Final[str] = user_message(
5464
"Access to this account is no longer available. Please contact support for more information: {support_email}"
5565
)
56-
MSG_USER_EXPIRED: Final[str] = (
66+
MSG_USER_EXPIRED: Final[str] = user_message(
5767
"This account has expired and access is no longer available. Please contact support for assistance: {support_email}"
5868
)
59-
MSG_USER_DISABLED: Final[str] = (
69+
MSG_USER_DISABLED: Final[str] = user_message(
6070
"This account has been disabled and cannot be registered again. Please contact support for details: {support_email}"
6171
)
62-
MSG_WRONG_2FA_CODE__INVALID: Final[str] = (
72+
MSG_WRONG_2FA_CODE__INVALID: Final[str] = user_message(
6373
"The code entered is not valid. Please enter a valid code or generate a new one."
6474
)
65-
MSG_WRONG_2FA_CODE__EXPIRED: Final[str] = (
75+
MSG_WRONG_2FA_CODE__EXPIRED: Final[str] = user_message(
6676
"The code has expired. Please generate a new code."
6777
)
68-
MSG_WRONG_CAPTCHA__INVALID: Final[str] = (
78+
MSG_WRONG_CAPTCHA__INVALID: Final[str] = user_message(
6979
"The CAPTCHA entered is incorrect. Please try again."
7080
)
71-
MSG_WRONG_PASSWORD: Final[str] = "The password is incorrect. Please try again."
72-
MSG_WEAK_PASSWORD: Final[str] = (
81+
MSG_WRONG_PASSWORD: Final[str] = user_message(
82+
"The password is incorrect. Please try again."
83+
)
84+
MSG_WEAK_PASSWORD: Final[str] = user_message(
7385
"Password must be at least {LOGIN_PASSWORD_MIN_LENGTH} characters long."
7486
)
75-
MSG_INVITATIONS_CONTACT_SUFFIX: Final[str] = (
87+
MSG_INVITATIONS_CONTACT_SUFFIX: Final[str] = user_message(
7688
"Please contact our support team to request a new invitation."
7789
)
7890

0 commit comments

Comments
 (0)