adapter.py 697 B

1234567891011121314151617181920212223
  1. from django.utils.translation import gettext_lazy as _
  2. from django.contrib.auth.models import AbstractUser
  3. from allauth.account.adapter import DefaultAccountAdapter
  4. class CustomAccountAdapter(DefaultAccountAdapter):
  5. error_messages = {
  6. #
  7. "username_blacklisted": _(
  8. "Username can not be used. Please use other username."
  9. ),
  10. "username_taken": AbstractUser._meta.get_field("username").error_messages[
  11. "unique"
  12. ],
  13. "too_many_login_attempts": _(
  14. "Too many failed login attempts. Try again later."
  15. ),
  16. "email_taken": _("A user is already registered with this e-mail address."),
  17. }