|
1 | 1 | from typing import Final |
2 | 2 |
|
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( |
7 | 13 | "Please activate your account via the email we sent before logging in." |
8 | 14 | ) |
9 | | -MSG_AUTH_FAILED: Final[str] = ( |
| 15 | +MSG_AUTH_FAILED: Final[str] = user_message( |
10 | 16 | "Authorization was not successful. Please check your credentials and try again." |
11 | 17 | ) |
12 | | -MSG_CANT_SEND_MAIL: Final[str] = ( |
| 18 | +MSG_CANT_SEND_MAIL: Final[str] = user_message( |
13 | 19 | "Unable to send email at this time. Please try again later." |
14 | 20 | ) |
15 | | -MSG_CHANGE_EMAIL_REQUESTED: Final[str] = ( |
| 21 | +MSG_CHANGE_EMAIL_REQUESTED: Final[str] = user_message( |
16 | 22 | "Please click the verification link sent to your new email address." |
17 | 23 | ) |
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( |
20 | 26 | "This email address is already registered. Try logging in or use a different address." |
21 | 27 | ) |
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( |
26 | 34 | "You've requested a password reset recently. Please use the link we sent you or wait before requesting again." |
27 | 35 | ) |
28 | | -MSG_PASSWORD_CHANGE_NOT_ALLOWED: Final[str] = ( |
| 36 | +MSG_PASSWORD_CHANGE_NOT_ALLOWED: Final[str] = user_message( |
29 | 37 | "Unable to reset password. Permissions may have expired or been removed. " |
30 | 38 | "Please try again, or contact support if the problem continues: {support_email}" |
31 | 39 | ) |
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( |
34 | 42 | "Password and confirmation do not match. Please try again." |
35 | 43 | ) |
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( |
38 | 48 | "You can no longer resend the code. Please restart the verification process." |
39 | 49 | ) |
40 | | -MSG_UNAUTHORIZED_LOGIN_2FA: Final[str] = ( |
| 50 | +MSG_UNAUTHORIZED_LOGIN_2FA: Final[str] = user_message( |
41 | 51 | "You can no longer submit a code. Please restart the login process." |
42 | 52 | ) |
43 | | -MSG_UNAUTHORIZED_REGISTER_PHONE: Final[str] = ( |
| 53 | +MSG_UNAUTHORIZED_REGISTER_PHONE: Final[str] = user_message( |
44 | 54 | "Phone registration is no longer allowed. Please restart the registration process." |
45 | 55 | ) |
46 | | -MSG_UNAUTHORIZED_PHONE_CONFIRMATION: Final[str] = ( |
| 56 | +MSG_UNAUTHORIZED_PHONE_CONFIRMATION: Final[str] = user_message( |
47 | 57 | "You can no longer submit a code. Please restart the confirmation process." |
48 | 58 | ) |
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( |
51 | 61 | "This account is scheduled for deletion. To reactivate it or for more information, please contact support: {support_email}" |
52 | 62 | ) |
53 | | -MSG_USER_BANNED: Final[str] = ( |
| 63 | +MSG_USER_BANNED: Final[str] = user_message( |
54 | 64 | "Access to this account is no longer available. Please contact support for more information: {support_email}" |
55 | 65 | ) |
56 | | -MSG_USER_EXPIRED: Final[str] = ( |
| 66 | +MSG_USER_EXPIRED: Final[str] = user_message( |
57 | 67 | "This account has expired and access is no longer available. Please contact support for assistance: {support_email}" |
58 | 68 | ) |
59 | | -MSG_USER_DISABLED: Final[str] = ( |
| 69 | +MSG_USER_DISABLED: Final[str] = user_message( |
60 | 70 | "This account has been disabled and cannot be registered again. Please contact support for details: {support_email}" |
61 | 71 | ) |
62 | | -MSG_WRONG_2FA_CODE__INVALID: Final[str] = ( |
| 72 | +MSG_WRONG_2FA_CODE__INVALID: Final[str] = user_message( |
63 | 73 | "The code entered is not valid. Please enter a valid code or generate a new one." |
64 | 74 | ) |
65 | | -MSG_WRONG_2FA_CODE__EXPIRED: Final[str] = ( |
| 75 | +MSG_WRONG_2FA_CODE__EXPIRED: Final[str] = user_message( |
66 | 76 | "The code has expired. Please generate a new code." |
67 | 77 | ) |
68 | | -MSG_WRONG_CAPTCHA__INVALID: Final[str] = ( |
| 78 | +MSG_WRONG_CAPTCHA__INVALID: Final[str] = user_message( |
69 | 79 | "The CAPTCHA entered is incorrect. Please try again." |
70 | 80 | ) |
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( |
73 | 85 | "Password must be at least {LOGIN_PASSWORD_MIN_LENGTH} characters long." |
74 | 86 | ) |
75 | | -MSG_INVITATIONS_CONTACT_SUFFIX: Final[str] = ( |
| 87 | +MSG_INVITATIONS_CONTACT_SUFFIX: Final[str] = user_message( |
76 | 88 | "Please contact our support team to request a new invitation." |
77 | 89 | ) |
78 | 90 |
|
|
0 commit comments