Change Site_Name in Password Reset Email

Hey,

In my password reset email the site name is my server ip adress. Like this

You're receiving this email because you requested a password reset for your user account at 176.97.210.80:8000.

Please go to the following page and choose a new password:

http://176.97.210.80:8000/reset/confirm/......

Your username, in case you’ve forgotten: testuser22

Thanks for using our site!

The 176.97.210.80:8000 team


I want to place a string as my Site Name instead of the ip adress, where can I define that and is that possible?

It should be accessible via the admin for the the Site model. /admin/sites/site/ if you’re using the default admin url.

If it’s the situation where you want the Site Name at the bottom to be different from the URL embedded in the email, a quick look makes me think you have a couple of different options:

  • You can override the template with your own email template. (This is the approach we use.)

  • You can override the PasswordResetView with a custom form_valid method passing the domain_override parameter. See the save method in PasswordResetForm to see the context being passed to the email rendering call.
    (There may be another hook available to do this, but I’m not one if it exists.)

1 Like

I changed it like this

admin.sites.site.site_url = "DivusX.com"

and if I print the site_url it works. But in the email there’s still the ip adress

okay so I forgot to import the sites framework in the settings, now my mail looks like this

You're receiving this email because you requested a password reset for your user account at example.com.

Please go to the following page and choose a new password:

http://example.com/reset/confirm/...

Your username, in case you’ve forgotten: FLYAX2

where can I place the new values of those things? I tried with that:

admin.sites.site.site_url = "DivusX.com"
admin.sites.site.name = "DivusX"
admin.sites.site.site_title = "DivusX"
admin.sites.site.site_header = "DivusX"

in my admin.py but it doesnt change something

With the “sites” framework enabled you can specify the site domain and name via the admin interface.