LeoneBacciu / django-email-verification

A Django app that takes care of verifying a users's email address and activating their profile.
MIT License
353 stars 57 forks source link

Multiple users with same email raises an exception "MultipleObjectsReturned". #55

Closed ytpl65 closed 2 years ago

ytpl65 commented 2 years ago

`#Email Verification settings def verified_callback(user): user.is_active = True

EMAIL_VERIFIED_CALLBACK = verified_callback EMAIL_FROM_ADDRESS = 'abc@gmail.com' EMAIL_MAIL_SUBJECT = 'Confirm your email' EMAIL_MAIL_HTML = 'email.html' EMAIL_MAIL_PLAIN = 'mail_body.txt' EMAIL_TOKEN_LIFE = 60 * 60 EMAIL_PAGE_TEMPLATE = 'email_verify.html' EMAIL_PAGE_DOMAIN = 'http://abc.xyz.in/' EMAIL_MULTI_USER = True # optional (defaults to False)

For Django Email Backend

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_HOST_USER = 'abc@gmail.com' EMAIL_HOST_PASSWORD = 'xxxxxxxxxxx' # os.environ['password_key'] suggested EMAIL_USE_TLS = True

Traceback (most recent call last): File "/home/youtility33/Naveen/env/intelliwiz_django/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/home/youtility33/Naveen/env/intelliwiz_django/lib/python3.9/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, *callback_kwargs) File "/home/youtility33/Naveen/env/intelliwiz_django/lib/python3.9/site-packages/django_email_verification/views.py", line 13, in verify success, user = verify_token(token) File "/home/youtility33/Naveen/env/intelliwiz_django/lib/python3.9/site-packages/django_email_verification/confirm.py", line 74, in verify_token valid, user = default_token_generator.check_token(token) File "/home/youtility33/Naveen/env/intelliwiz_django/lib/python3.9/site-packages/django_email_verification/token.py", line 81, in check_token user = get_user_model().objects.get(email=email) File "/home/youtility33/Naveen/env/intelliwiz_django/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(args, **kwargs) File "/home/youtility33/Naveen/env/intelliwiz_django/lib/python3.9/site-packages/django/db/models/query.py", line 433, in get raise self.model.MultipleObjectsReturned(

Exception Type: MultipleObjectsReturned at /email-verify/bmF2ZWVuLnNhcmdhbUB5b3V0aWxpdHkuaW4-awxpa5-0e481f26dc67393564f46de0471d64f5eb208c5b Exception Value: get() returned more than one People -- it returned 7! `

ytpl65 commented 2 years ago

Anything wrong with my question, please reply !!! /\

LeoneBacciu commented 2 years ago

Hello, which version are you using? Try version 0.1.1rc1 and see if it makes any difference.

ytpl65 commented 2 years ago

Sorry its my mistake, I should've mention this at start, But here they are: django-email-verification == 0.1.0 Django== 3.1 Python == 3.9.2

ytpl65 commented 2 years ago

Hello, which version are you using? Try version 0.1.1rc1 and see if it makes any difference.

Okay I'll try, thank you for your reply.

ytpl65 commented 2 years ago

Hello, which version are you using? Try version 0.1.1rc1 and see if it makes any difference.

But how can i install it from pip, can you please guide me here. Done, No need thank you, I'll let you know the results by using '0.1.1rc1'.