0

장고 등록에서 장고 등록을 HMAC workflow으로 사용하고 있습니다. 등록 후 활성화 링크가있는 전자 메일이 사용자에게 전송됩니다. 내가 버전을 사용하고장고 등록 재설정 암호 오류

은 노호 :

Django==1.11.1 
django-registration==2.3 

내가 사용하고 있었다 두 개의 서로 다른 뷰 (기능 OU 클래스)이 있다는 것을 here을 보았다. 나는 auth_urls.py에 중단 점을 넣었고 내 응용 프로그램에서는 registration.auth_urls_classes이 사용되고있는 것을 보았습니다.

{% extends "base.html" %} 
{% load i18n %} 

{% block content %} 
<div class="row justify-content-center g-py-180"> 
    <div class="col-sm-10 col-md-9 col-lg-4"> 
     <header class="text-center g-mb-30"> 
      <h2 class="h2 g-color-black g-font-weight-600"> Resete sua senha </h2> 
     </header> 
     <form method="post" action="{% url 'auth_password_reset' %}"> 
      <h1 class="h5 g-font-weight-300">Forneça seu endereço de email e nós enviaremos para você um link para alterar sua senha.</h1> 


      {% csrf_token %} 

      {% for field in form %} 
       {% if field.name == 'email' %} 
        <div class="mb-4 mt-4"> 
         <input class="form-control g-color-black g-bg-white g-bg-white--focus g-brd-gray-light-v4 
         g-brd-primary--hover rounded g-py-15 g-px-15" type="email" required 
         placeholder="[email protected]" name="{{ field.html_name }}" id="{{ field.auto_id }}"> 
        </div> 
       {% endif %} 
      {% endfor %} 
      <button class="g-min-width-100x btn btn-md u-btn-primary rounded g-py-13 g-px-25" type="submit" value="Submit">Enviar email de redefinição de senha</button> 
     </form> 
    </div> 
</div> 
{% endblock %} 

후 :

이 링크 템플릿 password_reset_form.html로 전송
<a class="g-font-size-12" href="{% url 'auth_password_reset' %}">Esqueceu a senha?</a> 

, 그것은 울부 짖는 이미지에 있습니다

내 암호 재설정 페이지로 이동하는 링크를 만들었습니다 전자 메일 주소를 입력하고 양식을 보내면 전자 메일이 올바르게 전송되지만 (전자 메일이 도착 함) 다음 오류가 발생합니다.

페이지를 찾을 수 없습니다 (404) 신청 방법 : http://127.0.0.1:8000/accounts/password/reset/auth_password_reset_done

내 URL이 울부 짖는 소리로 정의됩니다 : 요청을 URL을 GET

urlpatterns = [ 
    url(r'^$', TemplateView.as_view(template_name='index.html'), name='home'), 

    #authentication 
    url(r'^accounts/', include('registration.backends.hmac.urls')), 

    url(r'^profile/', include('pxgbr2.account_settings.urls', namespace='profile')), 
    url(r'^admin/', admin.site.urls), 
] 

if settings.DEBUG: 
    urlpatterns += static(settings.MEDIA_URL, 
document_root=settings.MEDIA_ROOT) 

참고 성공 URL (auth_password_reset_done ')의 이름은 "추가되었다 "링크 대신 패턴으로 대체됩니다. 나는 이유를 알 수 없었다.

+1

텍스트의 스크린 샷을 게시하지 마십시오. –

답변

1

this issue을 기록한 것으로 보입니다. 이 당신이 시도 할 수있는 수정 pull request #111입니다 또는 장고의 인증 URL을 직접 포함하는 더 간단 할 수 있습니다 그래서 인증의 URL을 포함

registration.auth_urls will be removed in django-registration 3.0
url('^accounts/', include('django.contrib.auth.urls')), 
url('^accounts/', include('registration.backends.hmac.urls')), 

는 별도로 미래를위한 최선의 방법입니다.

+0

나는 이것을 이미 시도해 보았지만이 경우에는 효과가 있었지만 'password_reset_confirm.html'페이지에서 양식을 전송할 때와 같은 유형의 오류가 발생하고이를 해결할 수 없었습니다. {% url ' password_reset_confirm '%}이 양식에 일부 매개 변수 (token 및 uuid)가 필요합니다. 그래서 장고 등록만으로 솔루션을 찾고 있습니다. 나는 풀 요청을보고 내가 필요한 것을 본다. 그렇다면이 수정을 통해 장고 등록을 해제하지 않고 프로젝트에 의존성을 어떻게 추가 할 수 있습니까? –

+1

pip를 사용하여 끌어 오기 요청을 설치하는 방법은 [이 질문 (https://stackoverflow.com/questions/13561618/pip-how-to-install-a-git-pull-request)을 참조하십시오. – Alasdair

+1

'password_reset_confirm'보기를 되돌릴 때 항상 토큰과 uuid가 필요하다는 것에주의하십시오. [docs에 포함되어 있습니다] (https://docs.djangoproject.com/en/2.0/topics/auth/default/#django). contrib.auth.views.PasswordResetView). – Alasdair