Skip to content

Commit

Permalink
password change, and password reset
Browse files Browse the repository at this point in the history
  • Loading branch information
yahyaaly151989 committed Sep 20, 2023
1 parent faf2014 commit 736a110
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 3 deletions.
Binary file modified Module04/bookmarks/account/__pycache__/urls.cpython-311.pyc
Binary file not shown.
7 changes: 7 additions & 0 deletions Module04/bookmarks/account/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ <h1>Login</h1>
<input type="hidden" name="next" value="{{ next }}">
<p><input type="submit" value="Login"></p>
</form>

<p>
<a href="{% url 'password_reset' %}">
Forgotten your password?
</a>
</p>

</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "base.html" %}

{% block title %} Password changed {% endblock %}

{% block content %}
<h1>Password changed</h1>
<p>Your password has been changed successfully.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends "base.html" %}

{% block title %} Change your password {% endblock %}

{% block content %}
<h1>Change your password</h1>
<p>Use this form to change your password.</p>
<form method="post">
{{ form.as_p }}
{% csrf_token %}
<input type="submit" value="Change">
</form>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "base.html"%}

{% block title %} Password reset {% endblock %}

{% block content %}
<h1>Password reset</h1>
<p>Your password has been set. You can <a href="{% url 'login' %}">Login now</a> </p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends "base.html" %}

{% block title %} Reset your password {% endblock %}

{% block content %}
<h1>Reset your password</h1>

{% if validlink %}
<p>Please enter your password twice.</p>
<form method="post">
{{ form.as_p }}
{% csrf_token %}
<p><input type="submit" value="Change your password" /></p>
</form>
{% else %}
<p>The link is not valid......</p>
{% endif %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "base.html" %}

{% block title %} Reset your password {% endblock %}

{% block content %}
<h1>Reset your password</h1>
<p>We have send you a reset password to your email address.</p>
<p>If you don't receive a reset password email, please make sure you enter your email address correctly.</p>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Someone asked for password reset for email {{ email }}.

Follow the link below:
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}

Your username, in case you've forgotten: {{ user.get_username }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "base.html" %}

{% block title %} Reset your password {% endblock %}

{% block content %}
<h1>Forgotten your password</h1>
<p>Enter your email address to obtain a new password.</p>

<form method="post">
{{ form.as_p }}
{% csrf_token %}
<p><input type="submit" value="Send email"></p>
</form>
{% endblock %}
21 changes: 18 additions & 3 deletions Module04/bookmarks/account/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
from django.urls import path
from django.urls import path, include
from . import views
from django.contrib.auth import views as auth_views


urlpatterns = [
# path('login/', views.user_login, name='login'),
path('login/', auth_views.LoginView.as_view(), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
# path('login/', auth_views.LoginView.as_view(), name='login'),
# path('logout/', auth_views.LogoutView.as_view(), name='logout'),

# path('password-change/', auth_views.PasswordChangeView.as_view(), name='password_change'),
# path('password-change/done/', auth_views.PasswordChangeDoneView.as_view(), name='password_change_done'),

# path('password-reset', auth_views.PasswordResetView.as_view(), name='password_reset'),
# path('password-reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
# path('password-reset/<uidb64>/<token>', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
# path('password-reset/complete/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),


path('', include('django.contrib.auth.urls')),
path('dashboard/', views.dashboard, name='dashboard'),



]
8
Binary file modified Module04/bookmarks/bookmarks/__pycache__/settings.cpython-311.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions Module04/bookmarks/bookmarks/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,6 @@
LOGIN_REDIRECT_URL = 'dashboard'
LOGIN_URL = 'login'
LOGOUT_URL = 'logout'


EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Binary file modified Module04/bookmarks/db.sqlite3
Binary file not shown.

0 comments on commit 736a110

Please sign in to comment.