iMerica / dj-rest-auth

Authentication for Django Rest Framework
https://dj-rest-auth.readthedocs.io/en/latest/index.html
MIT License
1.62k stars 302 forks source link

Email customization problems #591

Open EkoPages opened 4 months ago

EkoPages commented 4 months ago

I use rest-auth combined with allauth for registration I customized the reigstration endpoints and also the email being returned to users

whenever I test it out in localhost it returns the email the way I want it to be returned

`Dear TestUser1,

Welcome to Ekopages, your gateway to sustainable education!

We're thrilled to have you join our community. To get started on your journey towards a greener future, please click the link below to confirm your email address:

https://ekopages.com/registration/account-confirm-email/NTE:1rUpCQ:qimz8K0QFUD5ZM8WbMlmcBqq3HSzNp0vNSziMaJRV44/

Once confirmed, you'll have full access to ekopages.com, where learning meets sustainability.

Thank you for choosing Ekopages. Let's embark on this educational adventure together!

Green regards, The EkoPages Team. ekopages.com`

but whenever I push to production it returns

`Hello from !

Dear TestUser01, Welcome to Ekopages, your gateway to sustainable education!

We're thrilled to have you join our community. To get started on your journey towards a greener future, please click the link below to confirm your email address:

https://ekopages.com/registration/account-confirm-email/ODI:1rYDAZ:9-iTNT6_wtKMwvWsrLLc1ATuzNwWIxAvTjUxLDP5G4Q/

Once confirmed, you'll have full access to ekopages.com, where learning meets sustainability.

Thank you for using !`

Ive modified the emails and even the custom adapter still no luck. What can I do to fix this issue?

Nealium commented 4 months ago

This isn't an issue with dj-rest-auth, this email is an allauth feature.

Adding USE_I18N = False (disable translations) to your settings.py might fix your issue.

If it doesn't fix it or you want to keep translations: You're issue resides with the base_message.txt "extends" inside email_confirmation_message.txt. Instead of removing the extends, the easiest fix for you is to override base_message.txt (this way it'll remove this text from all emails)

New File: {yourApp}/{yourTemplatesDir}/account/email/base_message.txt File Contents:

{% block content %}{% endblock content %}

Original File

Explanation: I removed the translation blocks and the translation (i18n) load from the original

The reason you are getting two results (debug v production) most likely has something to do with translation not working while you're in debug. Theory being: there's no locale set/found in debug and therefor the blocks don't render. I'm not sure why this is. Docs

Unfortunately, I don't know where you're "Green regards," block went and I can't tell with the info provided. I suggest adding it to the new base_message.txt maybe that will fix it, plus it'll show up at the end of every email