diff --git a/db.sqlite3 b/db.sqlite3 index a5631b5..9c5c1e0 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/news/__pycache__/urls.cpython-37.pyc b/news/__pycache__/urls.cpython-37.pyc index 5009421..069dbde 100644 Binary files a/news/__pycache__/urls.cpython-37.pyc and b/news/__pycache__/urls.cpython-37.pyc differ diff --git a/news/__pycache__/views.cpython-37.pyc b/news/__pycache__/views.cpython-37.pyc index e3f10c5..5731023 100644 Binary files a/news/__pycache__/views.cpython-37.pyc and b/news/__pycache__/views.cpython-37.pyc differ diff --git a/news/static/news/css/app.css b/news/static/news/css/app.css index 0a85185..3700345 100644 --- a/news/static/news/css/app.css +++ b/news/static/news/css/app.css @@ -227,6 +227,10 @@ form textarea:active, form textarea:hover, form textarea:visited, form textarea: border-radius: 5px; } */ +form label { + color: #fff; +} + input[type=password] { padding:0px 5px; border:2px solid #ccc; diff --git a/news/templates/news/user/change_password.html b/news/templates/news/user/change-password.html similarity index 72% rename from news/templates/news/user/change_password.html rename to news/templates/news/user/change-password.html index 2818acc..52e3cec 100644 --- a/news/templates/news/user/change_password.html +++ b/news/templates/news/user/change-password.html @@ -9,7 +9,7 @@
{% csrf_token %} {{ form }} - +
{% endblock %} diff --git a/news/templates/news/user/password_reset_complete.html b/news/templates/news/user/password_reset_complete.html new file mode 100644 index 0000000..4415e0d --- /dev/null +++ b/news/templates/news/user/password_reset_complete.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block content %} +

+ Your password has been set. You may go ahead and sign in now. +

+{% endblock %} diff --git a/news/templates/news/user/password_reset_confirm.html b/news/templates/news/user/password_reset_confirm.html new file mode 100644 index 0000000..fa5e045 --- /dev/null +++ b/news/templates/news/user/password_reset_confirm.html @@ -0,0 +1,17 @@ +{% extends 'base.html' %} + +{% block content %} + {% if validlink %} +

Change password

+
+ {% csrf_token %} + {{ form.as_p }} + +
+ {% else %} +

+ The password reset link was invalid, possibly because it has already been used. + Please request a new password reset. +

+ {% endif %} +{% endblock %} diff --git a/news/templates/news/user/password_reset_done.html b/news/templates/news/user/password_reset_done.html new file mode 100644 index 0000000..3a72b85 --- /dev/null +++ b/news/templates/news/user/password_reset_done.html @@ -0,0 +1,9 @@ + +{% extends 'base.html' %} + +{% block title %}Email Sent{% endblock %} + +{% block content %} +

Check your inbox.

+

We've emailed you instructions for setting your password. You should receive the email shortly!

+{% endblock %} diff --git a/news/templates/news/user/password_reset_email.html b/news/templates/news/user/password_reset_email.html new file mode 100644 index 0000000..d64f5aa --- /dev/null +++ b/news/templates/news/user/password_reset_email.html @@ -0,0 +1 @@ +pouet pouet diff --git a/news/templates/news/user/password_reset_form.html b/news/templates/news/user/password_reset_form.html new file mode 100644 index 0000000..03a9232 --- /dev/null +++ b/news/templates/news/user/password_reset_form.html @@ -0,0 +1,15 @@ + +{% extends 'base.html' %} + +{% block title %}Forgot Your Password?{% endblock %} + +{% block content %} +

Forgot your password?

+

Enter your email address below, and we'll email instructions for setting a new one.

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} diff --git a/news/templates/news/user/password_reset_html_email.html b/news/templates/news/user/password_reset_html_email.html new file mode 100644 index 0000000..d159c9c --- /dev/null +++ b/news/templates/news/user/password_reset_html_email.html @@ -0,0 +1,2 @@ +Someone asked for password reset for email {{ email }}. Follow the link below: +{{ protocol}}://{{ domain }}{% url 'news:password_reset_confirm' uidb64=uid token=token %} diff --git a/news/templates/news/user/signin.html b/news/templates/news/user/signin.html index fe4da3f..0136853 100644 --- a/news/templates/news/user/signin.html +++ b/news/templates/news/user/signin.html @@ -28,6 +28,8 @@ + + Forgotten password? {% endblock %} diff --git a/news/urls.py b/news/urls.py index 9659c7f..013eafa 100644 --- a/news/urls.py +++ b/news/urls.py @@ -1,4 +1,5 @@ -from django.urls import path, re_path +from django.urls import path, re_path, include +from django.contrib.auth import views as auth_views from . import views @@ -17,5 +18,21 @@ urlpatterns = [ path('logout', views.logout_view, name='logout_view'), path('password-change', views.password_change, name='password_change'), re_path(r'^register/$', views.register, name='register'), + # path('change-password/', auth_views.PasswordChangeView.as_view(template_name='change-password.html'),), + # path('change-password/done', views.password_change, name='password_change_done'), + # path('password-reset', auth_views.PasswordResetView.as_view(template_name='news/user/password_reset_form.html'), name='password_reset'), + path('password_reset/', auth_views.PasswordResetView.as_view( + template_name='news/user/password_reset_form.html', + email_template_name='news/user/password_reset_email.html', + html_email_template_name='news/user/password_reset_html_email.html', + success_url='../password-reset/done' + ), name='password_reset'), + path('password-reset/done', auth_views.PasswordResetDoneView.as_view(template_name='news/user/password_reset_done.html'), name='password_reset_done'), + # path('accounts/', include('django.contrib.auth.urls')), + path('reset//', auth_views.PasswordResetConfirmView.as_view( + template_name='news/user/password_reset_confirm.html', + success_url='../password-change/done'), name='password_reset_confirm'), + path('password-change/done', auth_views.PasswordResetCompleteView.as_view(template_name='news/user/password_reset_complete.html'), name='password_change_done'), + # path('reset//', views.empty_view, name='password_reset_confirm'), ] diff --git a/news/views.py b/news/views.py index 4701cb1..31e0bcc 100644 --- a/news/views.py +++ b/news/views.py @@ -164,3 +164,6 @@ def upvote(request, comment_id): comment.save() post = comment.post return HttpResponseRedirect(reverse('news:post', args=(post.id,))) + +def empty_view(request): + return HttpResponse('') diff --git a/pokercc/__pycache__/settings.cpython-37.pyc b/pokercc/__pycache__/settings.cpython-37.pyc index 6e75b4b..d8c1964 100644 Binary files a/pokercc/__pycache__/settings.cpython-37.pyc and b/pokercc/__pycache__/settings.cpython-37.pyc differ diff --git a/pokercc/settings.py b/pokercc/settings.py index 4ec7910..393b003 100644 --- a/pokercc/settings.py +++ b/pokercc/settings.py @@ -29,6 +29,7 @@ DEBUG = True ALLOWED_HOSTS = [] +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # Application definition