@@ -34,3 +34,7 @@ class UserAlreadyExists(Exception): class DomainNotFound(Exception): def __str__(self): return _('Domain not found') + +class InactiveAccountForbidden(Exception): + def __str__(self): + return _('Account is inactive') \ No newline at end of file @@ -99,6 +99,7 @@ class BusinessHostService: password = generate_token(15) user.set_password(password) user.is_deleted = False + user.active = True user.save() EmailService.send_corporate_greeting_email(account_service.account, password) return account_service @@ -169,6 +170,9 @@ class BusinessHostService: if self.user.account_type == 'business_admin' == account.user.account_type: raise AdminDeleteForbidden + account.user.active = False + account.user.is_deleted = True + account.user.save() account.delete() def create_host(self, request: Request) -> UserDataSerializer: @@ -219,5 +223,6 @@ class BusinessHostService: password = generate_token(15) business_account.user.set_password(password) business_account.user.is_deleted = False + business_account.user.active = True business_account.user.save() EmailService(self.user).send_reinvited_email(business_account, password) @@ -12,7 +12,7 @@ from authentication.exceptions.business_host_exceptions.not_allowed_ip import ( NotAllowedIP, ) from authentication.exceptions.email_token import EmailTokenNotFound -from authentication.exceptions.user import EmailNotConfirmed, UserAlreadyExists, WrongEmail, WrongPassword +from authentication.exceptions.user import EmailNotConfirmed, UserAlreadyExists, WrongEmail, WrongPassword, InactiveAccountForbidden from authentication.models import ( CompanyIPWhitelist, CustomUserModel, @@ -58,6 +58,8 @@ class UserService: if user := CustomUserModel.objects.filter(email=email).first(): if not user.is_deleted: raise UserAlreadyExists + if not user.active: + raise InactiveAccountForbidden user.is_deleted = False user.set_password(user_data['password']) else: @@ -44,6 +44,7 @@ from authentication.exceptions.email_exceptions import LetterNotFound, LetterUnk from authentication.exceptions.email_exceptions.token_not_found import TokenNotFound from authentication.exceptions.email_token import EmailTokenNotFound from authentication.exceptions.user import ( + InactiveAccountForbidden, DomainNotFound, EmailNotConfirmed, PasswordsDoNotMatch, @@ -234,6 +235,8 @@ class UserAPIView(APIView): return Response(status=status.HTTP_201_CREATED) except (UserAlreadyExists, ValidationError) as exc: return Response({'detail': f'{exc}'}, status=status.HTTP_400_BAD_REQUEST) + except InactiveAccountForbidden as exc: + return Response({'detail': f'{exc}'}, status=status.HTTP_403_FORBIDDEN) except DomainNotFound: return Response({'detail': _('Email not found')}, status=status.HTTP_400_BAD_REQUEST) except Exception as exc: @@ -2,13 +2,13 @@ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. -# +# #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-05-14 22:35+0300\n" +"POT-Creation-Date: 2026-05-24 19:37+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,7 @@ msgstr "" "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || " "(n%100>=11 && n%100<=14)? 2 : 3);\n" -#: authentication/exceptions/business_account.py:6 authentication/views.py:436 +#: authentication/exceptions/business_account.py:6 authentication/views.py:439 msgid "Business account not found" msgstr "Сотрудник не найден" @@ -140,6 +140,10 @@ msgstr "Пользователь уже существует" msgid "Domain not found" msgstr "Домен не найден" +#: authentication/exceptions/user.py:40 +msgid "Account is inactive" +msgstr "Аккаунт неактивен" + #: authentication/models/business_account.py:16 payments/models/promocode.py:72 #: tools/public_api/models.py:34 tools/public_api/services/api_key.py:24 msgid "Owner" @@ -207,7 +211,7 @@ msgstr "Бизнес Группы" #: authentication/models/user.py:224 authentication/models/user_telegram.py:22 #: authentication/models/user_vk.py:12 payments/admin.py:37 #: payments/admin.py:95 payments/models/invoice.py:15 -#: payments/models/payment.py:26 payments/models/payment_plan.py:50 +#: payments/models/payment.py:26 payments/models/payment_plan.py:43 #: tools/media/models.py:108 msgid "User" msgstr "Пользователь" @@ -557,52 +561,52 @@ msgstr "Приглашенный аккаунт может принять или msgid "Error occured when proceed email sending" msgstr "Случилась ошибка во время отправки email" -#: authentication/services/user_services.py:164 +#: authentication/services/user_services.py:166 msgid "No user like this in a database" msgstr "Такой пользователь отсутствует" -#: authentication/services/user_services.py:181 +#: authentication/services/user_services.py:183 msgid "token is not provided" msgstr "" -#: authentication/services/user_services.py:205 +#: authentication/services/user_services.py:207 msgid "No email token provided" msgstr "Токен не получен" -#: authentication/services/user_services.py:215 +#: authentication/services/user_services.py:217 msgid "Passwords do not match" msgstr "Пароли не совпадают" -#: authentication/services/user_services.py:253 +#: authentication/services/user_services.py:255 msgid "Current password is wrong" msgstr "Текущий пароль неверен" -#: authentication/views.py:133 authentication/views.py:242 -#: authentication/views.py:348 authentication/views.py:381 +#: authentication/views.py:134 authentication/views.py:245 +#: authentication/views.py:351 authentication/views.py:384 msgid "Server error occured" msgstr "Случилась серверная ошибка" -#: authentication/views.py:238 +#: authentication/views.py:241 msgid "Email not found" msgstr "Email не найден" -#: authentication/views.py:318 authentication/views.py:370 +#: authentication/views.py:321 authentication/views.py:373 msgid "Email sending error: email not found" msgstr "Ошибка отправки письма: email не найден" -#: authentication/views.py:340 +#: authentication/views.py:343 msgid "Business account has been deleted" msgstr "Сотрудник успешно удален" -#: authentication/views.py:368 +#: authentication/views.py:371 msgid "Business account has been reinvited" msgstr "Повторное приглашение сотруднику успешно отправлено" -#: authentication/views.py:440 +#: authentication/views.py:443 msgid "Business account password has been updated" msgstr "Пароль сотрудника успешно обновлен" -#: authentication/views.py:489 +#: authentication/views.py:492 msgid "Could not confirm email, please try again." msgstr "Невозможно подтвердить email, попробуйте позже" @@ -666,7 +670,9 @@ msgstr "" #: ml_model/exceptions.py:47 #, python-format msgid "Image exceeds the maximum allowed pixel count (%(max_pixels)d)." -msgstr "Размер изображения превышает максимально допустимое количество пикселей (%(max_pixels)d)." +msgstr "" +"Размер изображения превышает максимально допустимое количество пикселей " +"(%(max_pixels)d)." #: ml_model/exceptions.py:53 msgid "The model is not responding" @@ -754,16 +760,10 @@ msgid "Available only in paid plan" msgstr "Доступно только в платном тарифе" #: ml_model/exceptions.py:171 -msgid "The \"Use code\" option cannot be used together with an attached image." -msgstr "" -"Нельзя одновременно использовать параметр «Использовать код» вместе с " -"прикреплённым изображением." - -#: ml_model/exceptions.py:177 msgid "Face not found in the image. Please try another image with a face." msgstr "Не найдено лицо на картинке. Попробуйте другую картинку с лицом." -#: ml_model/exceptions.py:168 +#: ml_model/exceptions.py:176 msgid "The input image may contain real person." msgstr "Загруженное изображение может содержать реального человека." @@ -1054,11 +1054,18 @@ msgstr "Инструкции Моделей" msgid "no model by this id" msgstr "Не найдено моделей по этому ID" -#: ml_model/services/chatgpt.py:154 +#: ml_model/services/chatgpt.py:149 msgid "No matching version found" msgstr "Соответствующая версия не найдена" -#: ml_model/services/chatgpt_5_4.py:270 +#: ml_model/services/chatgpt_5.py:130 ml_model/services/chatgpt_5_4.py:156 +#: ml_model/services/chatgpt_5_5.py:214 +msgid "The \"Use code\" option cannot be used together with an attached image." +msgstr "" +"Нельзя одновременно использовать параметр «Использовать код» вместе с " +"прикреплённым изображением." + +#: ml_model/services/chatgpt_5_4.py:315 ml_model/services/chatgpt_5_5.py:366 msgid "Image is ready" msgstr "Изображение готово" @@ -1089,7 +1096,7 @@ msgstr "Неизвестный бакет для загрузки" msgid "1080p output is not supported for Seedance Dreamina 2.0 Fast." msgstr "1080р разрешение не поддерживается для Seedance Dreamina 2.0 Fast." -#: ml_model/services/seedream.py:78 +#: ml_model/services/seedream.py:87 msgid "3K output is not supported for Seedream 4.5" msgstr "3К разрешение не поддерживается для Seedream 4.5" @@ -1097,7 +1104,7 @@ msgstr "3К разрешение не поддерживается для Seedre msgid "No image given for improving" msgstr "Нет изображения для улучшения" -#: ml_model/tasks.py:188 +#: ml_model/tasks.py:137 msgid "Lyrics is too long" msgstr "Текст песни слишком длинный" @@ -1115,7 +1122,7 @@ msgstr "" msgid "Missing" msgstr "Отсутствующий" -#: payments/apps.py:12 payments/models/payment.py:60 +#: payments/apps.py:11 payments/models/payment.py:60 msgid "Payments" msgstr "Платежи" @@ -1184,36 +1191,36 @@ msgstr "Индивидуальный" msgid "Is visible" msgstr "Видимый" -#: payments/models/payment_plan.py:41 payments/models/payment_plan.py:56 +#: payments/models/payment_plan.py:34 payments/models/payment_plan.py:49 #: payments/models/payment_plan_feature.py:16 msgid "Payment Plan" msgstr "Платежный План" -#: payments/models/payment_plan.py:42 +#: payments/models/payment_plan.py:35 msgid "Payment Plans" msgstr "Платежные Планы" -#: payments/models/payment_plan.py:58 +#: payments/models/payment_plan.py:51 msgid "Last payment at" msgstr "Последнее время платежа" -#: payments/models/payment_plan.py:59 +#: payments/models/payment_plan.py:52 msgid "Next payment at" msgstr "Следующее время платежа" -#: payments/models/payment_plan.py:63 payments/models/user_payment_method.py:25 +#: payments/models/payment_plan.py:56 payments/models/user_payment_method.py:25 msgid "Payment Method" msgstr "Платежный метод" -#: payments/models/payment_plan.py:69 +#: payments/models/payment_plan.py:62 msgid "Current balance" msgstr "Текущий баланс" -#: payments/models/payment_plan.py:75 +#: payments/models/payment_plan.py:68 msgid "Referral balance" msgstr "Реферальный баланс" -#: payments/models/payment_plan.py:96 payments/models/payment_plan.py:97 +#: payments/models/payment_plan.py:89 payments/models/payment_plan.py:90 msgid "User Balance" msgstr "Баланс пользователя" @@ -1353,13 +1360,13 @@ msgstr "" msgid "Unknown account type" msgstr "Неизвестный тип аккаунта" -#: payments/tests/test_plans.py:23 payments/tests/test_plans.py:191 -#: payments/tests/test_plans.py:194 +#: payments/tests/test_plans.py:23 payments/tests/test_plans.py:205 +#: payments/tests/test_plans.py:208 msgid "Chat-bots" msgstr "Чат-боты" -#: payments/tests/test_plans.py:27 payments/tests/test_plans.py:192 -#: payments/tests/test_plans.py:197 +#: payments/tests/test_plans.py:27 payments/tests/test_plans.py:206 +#: payments/tests/test_plans.py:211 msgid "Images" msgstr "Изображения" @@ -1399,7 +1406,7 @@ msgstr "Публичный API" msgid "Media" msgstr "Медиа" -#: tools/chats/apis.py:201 tools/media/apis.py:209 +#: tools/chats/apis.py:203 tools/media/apis.py:209 #: tools/public_api/views/base.py:100 msgid "" "An unexpected generation error has occurred. Please try again later or use a " @@ -1408,7 +1415,7 @@ msgstr "" "Произошла непредвиденная ошибка при генерации. Пожалуйста попробуйте позже " "или используйте другую модель" -#: tools/chats/apis.py:257 +#: tools/chats/apis.py:259 msgid "The message has already been deleted" msgstr "Сообщение уже было удалено" @@ -1638,9 +1645,6 @@ msgstr "Пресеты общие для всех — их нельзя удал #~ msgid "Issued achievement" #~ msgstr "Выданное достижение" -#~ msgid "Account is already confirmed" -#~ msgstr "Аккаунт уже подтвержден" - #~ msgid "Stories" #~ msgstr "Истории"