diff options
| author | Weitian LI <liweitianux@gmail.com> | 2014-04-20 19:04:25 +0800 | 
|---|---|---|
| committer | Weitian LI <liweitianux@gmail.com> | 2014-04-20 19:04:25 +0800 | 
| commit | 7a1f582dd1ae7ddfe9765c74b6dc828d4b6ad904 (patch) | |
| tree | ff2aa5029bcade529b16cee802068d59dcf478a8 /account | |
| parent | e0c0722e2f836c6773b8639739a6890dd0f7d52f (diff) | |
| download | django-skaschool-7a1f582dd1ae7ddfe9765c74b6dc828d4b6ad904.tar.bz2 | |
added 'password_change' and 'password_change_done' views and templates
Diffstat (limited to 'account')
| -rw-r--r-- | account/templates/account/password_change.html | 24 | ||||
| -rw-r--r-- | account/templates/account/password_change_done.html | 21 | ||||
| -rw-r--r-- | account/urls.py | 19 | 
3 files changed, 60 insertions, 4 deletions
diff --git a/account/templates/account/password_change.html b/account/templates/account/password_change.html new file mode 100644 index 0000000..372bb0c --- /dev/null +++ b/account/templates/account/password_change.html @@ -0,0 +1,24 @@ +{% extends 'base.html' %} +{% load staticfiles %} +{% load url from future %} +{% load bootstrap3 %} + +{# login template #} + +{% block title %} +修改密码 | 2014 SKA Summer School +{% endblock %} + +{% block content %} +  <div class="container"> +    <h2>修改密码</h2> +    <br /> +    <form role="form" class="form-horizontal" method="post"> +      {% csrf_token %} +      {% bootstrap_form form layout='horizontal' %} +      {% buttons submit='提交' reset='重置' layout='horizontal' %}{% endbuttons %} +    </form> +  </div> +{% endblock %} + +{# vim: set ts=8 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/account/templates/account/password_change_done.html b/account/templates/account/password_change_done.html new file mode 100644 index 0000000..e003033 --- /dev/null +++ b/account/templates/account/password_change_done.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} +{% load staticfiles %} +{% load url from future %} +{% load bootstrap3 %} + +{# login template #} + +{% block title %} +密码修改成功 | 2014 SKA Summer School +{% endblock %} + +{% block content %} +  <div class="container"> +    <h2>密码修改成功</h2> +    <p class="lead">您已成功修改密码。</p> +    <br /> +    <p><a href="{% url 'profile' %}" class="btn btn-default">返回个人主页</a></p> +  </div> +{% endblock %} + +{# vim: set ts=8 sw=2 tw=0 fenc=utf-8 ft=htmldjango.html: #} diff --git a/account/urls.py b/account/urls.py index c73d59c..671ac9a 100644 --- a/account/urls.py +++ b/account/urls.py @@ -7,6 +7,7 @@ customize 'registration.backends.default.urls' to use custom form  from django.conf.urls import patterns, include, url  from django.views.generic.base import TemplateView +from django.contrib.auth.decorators import login_required  from registration.backends.default.views import ActivationView  from registration.backends.default.views import RegistrationView @@ -40,6 +41,10 @@ urlpatterns = patterns('',      url(r'^activate/(?P<activation_key>\w+)/$',          ActivationView.as_view(),          name='registration_activate'), +    ## profile +    url(r'^profile/$', +        login_required(TemplateView.as_view(template_name='account/profile.html')), +        name='profile'),      ## django auth views      # login      url(r'^login/$', 'django.contrib.auth.views.login', @@ -49,10 +54,16 @@ urlpatterns = patterns('',      url(r'^logout/$', 'django.contrib.auth.views.logout',          {'template_name': 'account/logout.html'},          name='logout'), -    # profile -    url(r'^profile/$', -        TemplateView.as_view(template_name='account/profile.html'), -        name='profile'), +    # change password +    # If 'post_change_redirect' not provided, +    # then redirect to url 'password_change_done'. +    url(r'^password/change/$', 'django.contrib.auth.views.password_change', +        {'template_name': 'account/password_change.html'}, +        name='password_change'), +    # change password done +    url(r'^password/change/done$', 'django.contrib.auth.views.password_change_done', +        {'template_name': 'account/password_change_done.html'}, +        name='password_change_done'),  )  | 
