more precise error messages when searching users for click

This commit is contained in:
imperosol committed 2026-10-27 23:28:34 +01:00
1 parent 366551559d
commit 01edf1f688
2 files changed
+22 -3

No files matched your search

+7 -1
View File
@@ -130,8 +130,14 @@ class GetUserForm(forms.Form):
elif cleaned_data["id"]:
customer = Customer.objects.filter(user=cleaned_data["id"]).first()
if customer is None or not customer.can_buy:
if customer is None:
raise forms.ValidationError(_("User not found"))
if not customer.can_buy:
raise forms.ValidationError(_("This user cannot buy items on counters."))
if customer.user.is_banned_counter:
raise forms.ValidationError(
_("This user is banned from AE places. Take him/her out if you can.")
)
cleaned_data["user_id"] = customer.user_id
cleaned_data["user"] = customer.user
return cleaned_data