Open LoSaMe opened 1 year ago
getting same issue for me as well.
Looks like your SMTP backend isn't properly configured.
I think the dj-rest-auth registration views need a exception handling to avoid this issue.
Looks like your SMTP backend isn't properly configured.
Well, catching exceptions is a very delicate topic.
I'm writing an argument against doing this: My personal web dev history is mostly JavaEE stuff where I'm used to have all business logic calls as a transaction, which is guaranteed by the EJB component model. A single transaction can be changes in the database, sending an email for instance, or - in our scenario - both (typically database first, then send email). If an exception is thrown inside such an EJB call, the whole transaction has to be rolled back. I.e. if the email delivery to the upstream SMTP server fails, then the database changes have to be rolled back. The HTTP response should be something in the 500 range, but that's the task of the servlet that triggered the EJB call and that is receiving the exception.
Now, back to Django: With default configuration there are no transactions. With some configuration, transactions on the level of a single HTTP request are possible and the developer can decide what to do in case an exception pops up. Is dj-rest-auth going to anticipate that everyone uses the default behaviour? To me, catching an exception too early is paternalism. Libraries shouldn't do this. If you don't want to see the exception, then simply override the behaviour of the appropriate view by inheritance.
I tried with below settings,
ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_AUTHENTICATION_METHOD = 'username' ACCOUNT_EMAIL_VERIFICATION = "mandatory"
Now I can able to register the user.
//output { "detail": "Verification e-mail sent." }
But if I click the link that user must verify email, it showing below errors.
ImproperlyConfigured at /dj-rest-auth/registration/account-confirm-email/NTc:1s5ep8:fN6f-dfGaKRKCGCOo8w9mpqWwTUZM-KpuJ9jK_Il9lo/
TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'
When calling the code to register a user, the API initially returns a status 500 error. However, despite the error, the user is still created. Afterwards, when i delete this user and the registration code is executed again, the call is successful with a status of 201. The frontend (Vue.js) and Django are Docker containers. However, only the registration is problematic. Tried with dj-rest-auth 2.2.5 and 4.0.1.
That is the error message:
Traceback: