Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ static/
__pycache__/
env/
node_modules/
themes/
6 changes: 6 additions & 0 deletions assets/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ <h4 class="mb-5">
</div>

</div>
<div class="d-flex align-items-left justify-content-between">
<div class="form-check">
<a href="{{forgetPasswordUrl}}">Forget password?</a>
</div>
</div>

<div class="d-flex align-items-center justify-content-between">
<div class="form-check">
<input type="checkbox" [checked]="rememberMe" (change)="rememberMe = !rememberMe" name="" class="form-check-input" id="rememberUser">
Expand Down
1 change: 1 addition & 0 deletions assets/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions market/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]'
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.
Expand Down
52 changes: 52 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% load static %}

<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- PLUG INS -->
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/select2/dist/css/select2.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/animate.css/animate.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/ionicons/css/ionicons.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/bootstrap/dist/css/bootstrap-reboot.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/bootstrap/dist/css/bootstrap.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'src/styles.css' %}">
<!-- PLUG INS -->

<title>
{% block title %}
Marketplace
{% endblock title %}
</title>
</head>
<body >
<nav class="navbar navbar-expand-lg main-nav">
<div class="container">
<a href="http://localhost:4200/" class="navbar-brand">
<img src="{% static 'src/assets/images/logo.svg' %}" class="logo">
</a>
<ul class="ml-auto nav">
<li class="nav-item">
<a href="" class="nav-link">Swiftkind</a>
</li>
</ul>
</div>
</nav>
<main>
{% block content %}

{% endblock content %}
</main>
<script type="text/javascript" src="{% static 'node_modules/jquery/dist/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'node_modules/popper.js/dist/umd/popper.min.js' %}"></script>
<script type="text/javascript" src="{% static 'node_modules/bootstrap/dist/js/bootstrap.min.js' %}"></script>
<script type="text/javascript" src="{% static 'node_modules/select2/dist/js/select2.min.js' %}"></script>
<script type="text/javascript" src="{% static 'node_modules/retinajs/dist/retina.min.js' %}"></script>
<script type="text/javascript" src="{% static 'node_modules/wowjs/dist/wow.min.js' %}"></script>

<script type="text/javascript" src="{% static 'js/main.js' %}"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions templates/registration/password_reset_complete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends 'base.html' %}
{% load i18n %}

{% block content %}
<div class="container py-5">
<div class="text-center py-5">
<h2 class="section-title text-highlight mb-2">Forget your password?</h2>
<h4 class="mb-5">
{% trans "Your password has been set. Return to homepage to log in " %}
</h4>
</div>
</div>
{% endblock content %}
46 changes: 46 additions & 0 deletions templates/registration/password_reset_confirm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{% extends 'base.html' %}
{% load widget_tweaks %}
{% load i18n %}

{% block content %}
{% if validlink %}
<div class="container py-5">
<div class="text-center py-5">
<h2 class="section-title text-highlight mb-2">Forget your password?</h2>
<h4 class="mb-5">
{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}
</h4>
</div>
<div class="row">
<div class="col-md-6 offset-md-3">
<form id="form-reset-password" class="form row" method="post">
{% csrf_token %}
<fieldset class="module aligned">
<div class="form-group mb-5 pw-masking masked">
<span id="pass1-error" class="error-msg" >
{{ form.new_password1.errors }}
</span>
<label for="id_new_password1">{% trans 'New password:' %}</label>
{{ form.new_password1|add_class:"form-control"|attr:"type:text"|attr:"placeholder:New password" }}
</div>
<div class="form-group mb-5 pw-masking masked">
<span id="pass2-error" class="error-msg" >
{{ form.new_password2.errors }}
</span>
<label for="id_new_password2">{% trans 'Confirm password:' %}</label>
{{ form.new_password2|add_class:"form-control"|attr:"type:text"|attr:"placeholder:Confirm password"}}
</div>
<button class="btn btn-primary form-control mb-5" type="submit">{% trans 'Change my password' %}</button>

</fieldset>
</form>
</div>
</div>
</div>

{% else%}
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>

{% endif %}

{% endblock %}
13 changes: 13 additions & 0 deletions templates/registration/password_reset_done.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends 'base.html' %}
{% load i18n %}

{% block content %}
<div class="container py-5">
<p>{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}</p>

<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
<br>
<a href="http://localhost:4200/">Go to Homepage</button>

</div>
{% endblock content %}
12 changes: 12 additions & 0 deletions templates/registration/password_reset_email.html
Original file line number Diff line number Diff line change
@@ -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 %}
35 changes: 35 additions & 0 deletions templates/registration/password_reset_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% extends 'base.html' %}
{% load widget_tweaks %}

{% block title %}
Forget Password - Marketplace
{% endblock title %}

{% block content %}
<div class="container py-5">
<div class="text-center py-5">
<h2 class="section-title text-highlight mb-2">Forget your password?</h2>
<h4 class="mb-5">
Please enter your email address, we will respond with instructions to reset your password.
</h4>
</div>
<div class="col-md-6 offset-md-2">
<form id="form-register" class="form row" method="post">
{% csrf_token %}
<div class="col-md-6">
<div id="form-email" class="form-group mb-4">
<label>Email Address</label>
{{ form.email|add_class:"form-control"|attr:"placeholder:[email protected]" }}
<span id="fname-error" class="error-msg" >
{{ form.email.errors }}
</span>
<button class="btn btn-primary form-control mb-5"">Reset Password</button>
</div>

</div>

</form>
</div>
</div>

{% endblock content %}
3 changes: 3 additions & 0 deletions templates/registration/password_reset_subject.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% load i18n %}{% autoescape off %}
{% blocktrans %}Password reset on {{ site_name }}{% endblocktrans %}
{% endautoescape %}
10 changes: 9 additions & 1 deletion users/urls.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[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'),
]
1 change: 1 addition & 0 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down