2016-04-14 77 views
0

密碼重置在這裏叫的URL文件:與第三方電子郵件觸發器/事件更換Django的SMTP /屬性

url(r'^password/reset/$', 
     auth_views.password_reset, { 
      'post_reset_redirect': 'auth_password_reset_done', 
      'template_name': 'auth/password_reset_form.html', 
      'password_reset_form': AccountPasswordResetForm, 
      'email_template_name': 'auth/password_reset_email.html', 
      }, 
     name='auth_password_reset'), 

,而不是通過SMTP發送郵件「password_reset_email.html」我需要發送一些事件以及我的第三方電子郵件提供商的屬性。 我會如何去做這件事?也許通過更改password_reset()函數?或者,還有更好的方法?在urls.py

def my_password_reset(request, *args, **kwargs): 
    # Do the additional bussiness here 
    send_some_events() 
    # And then do the password reset as usual. 
    auth.views.password_reset(request, *args, **kwargs) 

更改呼叫:

回答

0

我會在我的應用程序views.py創建一個新的功能

url(r'^password/reset/$', 
    my_app.views.my_password_reset, ... 
當然
+0

!哈哈這麼簡單。我打算複製整個密碼重置功能,但這是一個更好的解決方案。謝謝! –