diff --git a/assets/src/app/app.component.ts b/assets/src/app/app.component.ts
index 5ac9619..382bd70 100644
--- a/assets/src/app/app.component.ts
+++ b/assets/src/app/app.component.ts
@@ -15,6 +15,7 @@ export class AppComponent implements OnInit {
usersForm;
errors;
rememberMe:boolean = false;
+ forgetPasswordUrl = "http://localhost:8000/user/password_reset/";
constructor(
private authService: AuthService,
diff --git a/market/settings.py b/market/settings.py
index 1b91af0..98a255f 100644
--- a/market/settings.py
+++ b/market/settings.py
@@ -159,6 +159,14 @@
os.path.join(BASE_DIR, 'assets/'),
]
+EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
+EMAIL_HOST = 'smtp.gmail.com'
+EMAIL_PORT = 587
+EMAIL_HOST_USER = 'bambolino35@gmail.com'
+EMAIL_HOST_PASSWORD = 'fqu8moex'
+DEFAULT_FROM_EMAIL= EMAIL_HOST_USER
+EMAIL_USE_TLS = True
+EMAIL_USE_SSL = False
# Allow any settings to be defined in local_settings.py which should be
# ignored in your version control system allowing for settings to be
# defined per machine.
diff --git a/templates/base.html b/templates/base.html
index e69de29..88bc7f0 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -0,0 +1,52 @@
+{% load static %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% block title %}
+ Marketplace
+ {% endblock title %}
+
+
+
+
+
+ {% block content %}
+
+ {% endblock content %}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/registration/password_reset_complete.html b/templates/registration/password_reset_complete.html
new file mode 100644
index 0000000..4249735
--- /dev/null
+++ b/templates/registration/password_reset_complete.html
@@ -0,0 +1,13 @@
+{% extends 'base.html' %}
+{% load i18n %}
+
+{% block content %}
+
+
+
Forget your password?
+
+ {% trans "Your password has been set. Return to homepage to log in " %}
+
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/templates/registration/password_reset_confirm.html b/templates/registration/password_reset_confirm.html
new file mode 100644
index 0000000..a589a25
--- /dev/null
+++ b/templates/registration/password_reset_confirm.html
@@ -0,0 +1,46 @@
+{% extends 'base.html' %}
+{% load widget_tweaks %}
+{% load i18n %}
+
+{% block content %}
+{% if validlink %}
+
+
+
Forget your password?
+
+ {% trans "Please enter your new password twice so we can verify you typed it in correctly." %}
+
+
+
+
+
+
+
+
+
+{% else%}
+
{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}
+
+{% endif %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/templates/registration/password_reset_done.html b/templates/registration/password_reset_done.html
new file mode 100644
index 0000000..57a9276
--- /dev/null
+++ b/templates/registration/password_reset_done.html
@@ -0,0 +1,13 @@
+{% extends 'base.html' %}
+{% load i18n %}
+
+{% block content %}
+
+
{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}
+
+
{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}
+{% endblock content %}
\ No newline at end of file
diff --git a/templates/registration/password_reset_email.html b/templates/registration/password_reset_email.html
new file mode 100644
index 0000000..2a55eee
--- /dev/null
+++ b/templates/registration/password_reset_email.html
@@ -0,0 +1,12 @@
+{% autoescape off %}
+To initiate the password reset process for your {{ user.get_username }} Swiftkind Market Account,
+click the link below:
+
+{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
+
+If clicking the link above doesn't work, please copy and paste the URL in a new browser
+window instead.
+
+Sincerely,
+The Swiftkind Team
+{% endautoescape %}
\ No newline at end of file
diff --git a/templates/registration/password_reset_form.html b/templates/registration/password_reset_form.html
new file mode 100644
index 0000000..4028578
--- /dev/null
+++ b/templates/registration/password_reset_form.html
@@ -0,0 +1,35 @@
+{% extends 'base.html' %}
+{% load widget_tweaks %}
+
+{% block title %}
+Forget Password - Marketplace
+{% endblock title %}
+
+{% block content %}
+
+
+
Forget your password?
+
+ Please enter your email address, we will respond with instructions to reset your password.
+
+
+
+
+
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/templates/registration/password_reset_subject.txt b/templates/registration/password_reset_subject.txt
new file mode 100644
index 0000000..45a354b
--- /dev/null
+++ b/templates/registration/password_reset_subject.txt
@@ -0,0 +1,3 @@
+{% load i18n %}{% autoescape off %}
+{% blocktrans %}Password reset on {{ site_name }}{% endblocktrans %}
+{% endautoescape %}
\ No newline at end of file
diff --git a/users/urls.py b/users/urls.py
index 3b1f842..f3742b5 100644
--- a/users/urls.py
+++ b/users/urls.py
@@ -1,4 +1,5 @@
-from django.urls import path, include
+from django.urls import path, include, re_path
+from django.contrib.auth import views as auth_views
from . import views
from rest_framework import routers
@@ -7,4 +8,11 @@
path('register/', views.Register.as_view()),
path('refresh/',views.RefreshToken.as_view()),
path('auth/', include('rest_framework.urls', namespace='rest_framework')),
+
+ # forget password links
+ path('password_reset/', auth_views.PasswordResetView.as_view(), name='password_reset'),
+ path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
+ re_path(r'^reset/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
+ auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
+ path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
]
diff --git a/users/views.py b/users/views.py
index d236539..c3cf6ab 100644
--- a/users/views.py
+++ b/users/views.py
@@ -6,6 +6,7 @@
from .serializers import LoginSerializer, RegisterSerializer
from .managers import UserManager
from rest_framework.exceptions import ValidationError
+from django.contrib.auth.views import PasswordResetView
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import parsers, renderers