LeoneBacciu / django-email-verification

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

increase info from exception #69

Closed millerthegorilla closed 2 years ago

millerthegorilla commented 2 years ago

Hi,

I have had a problem where I install the django-email-verification, and then install the wrong version of the library jwt. I should install PyJwt, but instead installed jwt. This led to an exception of

File "/var/home/dev/src/ceramic_isles_tests/venv/lib64/python3.10/site-packages/django_email_verification/confirm.py", line 42, in send_email
    raise InvalidUserModel('The user model you provided is invalid')
django_email_verification.errors.InvalidUserModel: The user model you provided is invalid

The code at line 41/42 is as follows... except AttributeError: raise InvalidUserModel('The user model you provided is invalid')

It would be nice if the exception raised were more informative.  So...

except (Exception, AttributeError) as e: raise InvalidUserModel('The user model you provided is invalid - ' + str(e))


This might help debug the issue more easily than adding it to the code in lib/site-packages...

I am quite happy to make a pull request, but rules around exception handling are often different...
millerthegorilla commented 2 years ago

Also, in testing some app code, I didn't reference the email urls in to the urls.py, and I received the 'ERROR: no verify view found'.

Perhaps add to the message 'have you added the function decorator to a custom view, and if not have you referenced the email in urls.py" or similar.

millerthegorilla commented 2 years ago

Also, I notice that you have changed the token encryption method. It no longer uses a custom salt, so it might be best to remove the option from the readme and the code. I am happy to do a pull request if this would help.

LeoneBacciu commented 2 years ago

Closed with da3c1391532c8b16cef162f5eabea5f80d8c0f65 and previous. Thanks a lot!