0

:allauthemailconfirmationメール確認エラー残り-AUTH

urlpatterns = [ 
    url(r'^admin/', admin.site.urls), 
    url(r'^rest-auth/', include('rest_auth.urls')), 
    url(r'^accounts/', include('allauth.urls')), 
    url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$', allauthemailconfirmation, name="account_confirm_email"),  
    url(r'^rest-auth/registration/', include('rest_auth.registration.urls')), 

] 

設定などallauth.account.views輸入confirm_emailから :

LOGIN_REDIRECT_URL='/' 
ACCOUNT_EMAIL_VERIFICATION='mandatory' 
ACCOUNT_CONFIRM_EMAIL_ON_GET=False 
ACCOUNT_EMAIL_REQUIRED = True 
ACCOUNT_USERNAME_REQUIRED = True 
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = False 

私が正しく取得電子メールが、あなたがリンクしようとするとき:

ImproperlyConfigured at /rest-auth/registration/account-confirm-email/MTU:1bn1OD:dQ_mCYi6Zpr8h2aKS9J9BvNdDjA/ 
TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()' 
+1

'+ W' が「拾っていません: "それで、それはdrに落ちるビューは、新しい形式に正規表現を変更してください – mariodev

+0

アカウントの確認メールに変更してください:(\ w +):(?P \ w +)/ $ '、 - 助けてくれません – Weit

+0

エラーとして、 'template_name'はビューの中で、私は想像しますか? – abidibo

答えて

3

私は見つけたと思う あなたの問題。

このURL:

url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$', allauthemailconfirmation, name="account_confirm_email"), 

が、以下による:

/rest-auth/registration/account-confirm-email/MTU:1bn1OD:dQ_mCYi6Zpr8h2aKS9J9BvNdDjA/ 

がこのパターンにマッチしていない

url(r'^rest-auth/registration/', include('rest_auth.registration.urls')), 

、あなたがrest_auth.registration.urlsのソースコードを見ればこのコードが表示されます:

# This url is used by django-allauth and empty TemplateView is 
# defined just to allow reverse() call inside app, for example when email 
# with verification link is being sent, then it's required to render email 
# content. 

# account_confirm_email - You should override this view to handle it in 
# your API client somehow and then, send post to /verify-email/ endpoint 
# with proper key. 
# If you don't want to use API on that step, then just use ConfirmEmailView 
# view from: 
# django-allauth https://github.com/pennersr/django-allauth/blob/master/allauth/account/views.py#L190 
url(r'^account-confirm-email/(?P<key>[-:\w]+)/$', TemplateView.as_view(), name='account_confirm_email'), 

だから、あなたは、このビューを上書きする必要がある、または、ここで説明したようにあなたは、あなたが持っているエラーが発生します。https://github.com/Tivix/django-rest-auth/issues/20

あなたが実際にビューを上書きしようとしましたが、あなたのマッチングパターンが間違っています、 :charが、それは失敗し、それでは

url(r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', allauthemailconfirmation, name="account_confirm_email"), 

関連部分のビーイングのようなものを試してみましょう:(P [ - :W \]?+)/ $

+0

ありがとう、それは動作します – Weit

関連する問題