Search code examples
djangodjango-formsresetchange-password

Example.com in django password reset


I have set up my django project to enable password reset but when the password reset mail is sent, i get the line https://example.com/accounts/reset/Mg/... . Exampple.com is not in any way related to my site. I have tried to remove it such that it reads my site url but to no avail


Solution

  • For future reference, django contrib auth uses current site domain provided by Site model in django.contrib.sites.models.

    To check which one do U have configured, enter into the shell with the desired settings and type:

    from django.contrib.sites.models import Site
    current_site = Site.objects.get_current()
    print(current_site.domain)
    

    This will show what domain will be used to construct absolute links like in this case, to reset the password.