0

I have a django project where I want to create users, and some time later be able to send a welcome email with a link inviting them to log in and set a password.

I'm using django-allauth. I found this SO question which shows how to call allauth's password reset form, which is close to what I need, except that:

  1. I want to send a "welcome" email, which would be worded differently.
  2. I want it to send them to a "welcome" page, which would be different to a password reset (although perhaps operate the same way in that it use a token etc...)

I'm thinking I could somehow hijack that, but am not sure how or where that email gets sent.

django-allauth docs mention the routes /accounts/password/set/ and /accounts/password/set/ but I can't access either without logging in first.

This is an existing project I inherited, and I do have a template for "/account/password_reset_from_key.html". Just not sure how it all gets wired together.

Has anyone done anything similar?

andyhasit
  • 14,137
  • 7
  • 49
  • 51

1 Answers1

0

You mention:

...and some time later be able to send a welcome email with a link inviting them to log in and set a password.

If sometime later, then you might be interested in queues like Celery to do that for you.

Here's an approach you might take:

  • Listen to the save django model signal on the User model. Send an email to a user whenever that is triggered (this will happen immediately. However with your "some time later" thing, then you add that sending to the user to a celery job queue for later
  • Send a dynamic email with html. With this, you can customize the design etc to your taste.
KhoPhi
  • 9,660
  • 17
  • 77
  • 128
  • By "some time later be able to" I simply meant by clicking a button, nothing to do with queuing, sorry. – andyhasit Dec 07 '17 at 14:00