-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
13 changed files
with
145 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
from django.conf.urls import url | ||
|
||
from .views import my_password_change, profile_view | ||
from . import views | ||
|
||
urlpatterns = [ | ||
url(r'^profile/$', profile_view, name='profile'), | ||
url(r'^security/$', my_password_change, name='security'), | ||
] | ||
url(r'^profile/$', views.profile_view, name='profile'), | ||
url(r'^security/$', views.my_password_change, name='security'), | ||
url(r'^password_reset/$', views.my_password_reset, name='reset_password'), | ||
url(r'^password_reset_done/$', views.my_password_reset_done, name='password_reset_done'), | ||
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', | ||
views.my_password_reset_confirm, name='password_reset_confirm'), | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from django.shortcuts import render, redirect, HttpResponseRedirect, reverse | ||
from django.views import View | ||
from django.contrib import messages | ||
|
||
from utils.auth_view import password_change, login | ||
from .forms import RegisterForm, MyPasswordChangeForm | ||
from django.contrib.auth import login | ||
from utils import auth_view | ||
from .forms import RegisterForm, MyPasswordChangeForm, MySetPasswordForm | ||
|
||
|
||
def profile_view(request): | ||
|
@@ -23,11 +23,31 @@ def register_view(request): | |
|
||
|
||
def my_password_change(request): | ||
return password_change(request, template_name='account/security.jinja2', | ||
post_change_redirect=reverse('account:profile'), | ||
password_change_form=MyPasswordChangeForm, | ||
message="Your password was changed successfully") | ||
return auth_view.password_change(request, template_name='account/security.jinja2', | ||
post_change_redirect=reverse('account:profile'), | ||
password_change_form=MyPasswordChangeForm, | ||
message="Your password was changed successfully") | ||
|
||
|
||
def my_login(request): | ||
return login(request, template_name='login.jinja2') | ||
return auth_view.login(request, template_name='login.jinja2') | ||
|
||
|
||
def my_password_reset(request): | ||
return auth_view.password_reset(request, | ||
from_email="[email protected]", | ||
template_name='account/password_reset.jinja2', | ||
post_reset_redirect='account:password_reset_done', | ||
email_template_name='account/password_reset_email.jinja2') | ||
|
||
|
||
def my_password_reset_done(request): | ||
return auth_view.password_reset_done(request, template_name='account/password_reset_done.jinja2') | ||
|
||
|
||
def my_password_reset_confirm(request, **kwargs): | ||
return auth_view.password_reset_confirm(request, | ||
template_name='account/password_reset_confirm.jinja2', | ||
post_reset_redirect=reverse('login'), | ||
set_password_form=MySetPasswordForm, | ||
**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% extends 'base.jinja2' %} | ||
|
||
{% block content %} | ||
|
||
<div class="bd-pageheader"> | ||
<div class="container"> | ||
<h1>Reset your password</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="container"> | ||
{% include 'components/form.jinja2' %} | ||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% extends 'base.jinja2' %} | ||
|
||
{% block content %} | ||
|
||
<div class="bd-pageheader"> | ||
<div class="container"> | ||
<h1>Reset your password</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="container"> | ||
{% include 'components/form.jinja2' %} | ||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{% extends 'base.jinja2' %} | ||
|
||
{% block content %} | ||
|
||
<div class="bd-pageheader"> | ||
<div class="container"> | ||
<h1>Password reset sent</h1> | ||
</div> | ||
</div> | ||
<div class="container"> | ||
<p> | ||
We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly. | ||
<br> | ||
If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder. | ||
</p> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% autoescape off %} | ||
You're receiving this email because you requested a password reset for your user account at {{ site_name }}. | ||
|
||
Please go to the following page and choose a new password: | ||
{% block reset_link %} | ||
{{ protocol }}://{{ domain }}{{ url('account:password_reset_confirm', uidb64=uid, token=token) }} | ||
{% endblock %} | ||
"Your username, in case you've forgotten:" {{ user.get_username() }} | ||
|
||
Thanks for using our site! | ||
|
||
The {{ site_name }} team | ||
|
||
{% endautoescape %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters