38# Added change/remind password

This commit is contained in:
Eligiusz Kurzawa 2021-01-17 13:23:56 +01:00
parent 1cafc376d0
commit a7d108089e
12 changed files with 293 additions and 23 deletions

View File

@ -25,6 +25,9 @@ SECRET_KEY = 'pb8%7mc+4z9s^a&86z@lexwe14hdi*qz41#a0ehqd3*ht#qc9a'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
ALLOWED_HOSTS = []

View File

@ -7,4 +7,5 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('', include('jobs.urls')),
path('users/', include('users.urls')),
path('users/', include('django.contrib.auth.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -4,7 +4,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>JobPortal</title>
<title>Job Portal</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@ -57,7 +57,7 @@
<a class="dropdown-item" href="{% url 'users:employer_messages' pk=user.pk %}">You have {{ user.count_unread_messages }} message(s)</a>
<a class="dropdown-item" href="{% url 'users:my_wish_list' pk=user.id %}">My wish list</a>
<a class="dropdown-item" href="{% url 'users:update_profile' pk=user.get_profile_id %}">Update profile</a>
<a class="dropdown-item" href="">Change password</a>
<a class="dropdown-item" href="{% url 'users:password_change' %}">Change password</a>
<a class="dropdown-item" href="{% url 'users:logout' %}">Logout</a>
</div>
</div>
@ -73,7 +73,7 @@
{% if user.get_profile_id %}
<a class="dropdown-item" href="{% url 'users:update_profile' pk=user.get_profile_id %}">Update profile</a>
{% endif %}
<a class="dropdown-item" href="">Change password</a>
<a class="dropdown-item" href="{% url 'users:password_change' %}">Change password</a>
<a class="dropdown-item" href="{% url 'users:logout' %}">Logout</a>
</div>
</div>

View File

@ -0,0 +1,30 @@
{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="hero-wrap js-fullheight" style="background-image: url('{% static 'images/bg_2.jpg' %}');" data-stellar-background-ratio="0.5"> <div class="overlay"></div>
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Password changed</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Password changed</h1>
</div>
</div>
</div>
</div>
<div class="ftco-section bg-light">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-8 mb-5">
{% if user.is_authenticated %}
<h3>Your password has been changed.</h3>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,72 @@
{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="hero-wrap js-fullheight" style="background-image: url('{% static 'images/bg_2.jpg' %}');" data-stellar-background-ratio="0.5"> <div class="overlay"></div>
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Change password</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Change password</h1>
</div>
</div>
</div>
</div>
<div class="ftco-section bg-light">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-8 mb-5">
{% if user.is_authenticated %}
<form action="#" class="p-5 bg-white" method="post">
{% csrf_token %}
{% if form.errors %}
<div class="alert alert-danger alert-dismissible" role="alert">
<div id="form_errors">
{% for key, value in form.errors.items %}
<span class="fieldWrapper">
{{ key }}: {{ value }}
</span>
{% endfor %}
</div>
<button type="button" class="close" data-dismiss="alert" aria_hidden="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endif %}
<div class="row form-group">
<div class="col-md-12 mb-3 mb-md-0">
<label class="font-weight-bold">Old password</label>
<input type="password" class="form-control" placeholder="Old password" name="old_password">
</div>
</div>
<div class="row form-group">
<div class="col-md-12 mb-3 mb-md-0">
<label class="font-weight-bold">New password</label>
<input type="password" class="form-control" placeholder="New password" name="new_password1">
</div>
</div>
<div class="row form-group">
<div class="col-md-12 mb-3 mb-md-0">
<label class="font-weight-bold">New password 2</label>
<input type="password" class="form-control" placeholder="New password 2" name="new_password2">
</div>
</div>
<div class="row form-group">
<div class="col-md-12">
<input type="submit" value="Change" class="btn btn-primary py-2 px-5">
</div>
</div>
</form>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,26 @@
{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="hero-wrap js-fullheight" style="background-image: url('{% static 'images/bg_2.jpg' %}');" data-stellar-background-ratio="0.5"> <div class="overlay"></div>
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Message</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Message</h1>
</div>
</div>
</div>
</div>
<div class="ftco-section bg-light">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-8 mb-5">
<h3>Your password has been updated.</h3>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,68 @@
{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="hero-wrap js-fullheight" style="background-image: url('{% static 'images/bg_2.jpg' %}');" data-stellar-background-ratio="0.5"> <div class="overlay"></div>
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Set new password</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Set new password</h1>
</div>
</div>
</div>
</div>
<div class="ftco-section bg-light">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-8 mb-5">
{% if validlink %}
<form action="#" class="p-5 bg-white" method="post">
{% csrf_token %}
{% if form.errors %}
<div class="alert alert-danger alert-dismissible" role="alert">
<div id="form_errors">
{% for key, value in form.errors.items %}
<span class="fieldWrapper">
{{ key }}: {{ value }}
</span>
{% endfor %}
</div>
<button type="button" class="close" data-dismiss="alert" aria_hidden="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endif %}
<div class="row form-group">
<div class="col-md-12 mb-3 mb-md-0">
<label class="font-weight-bold">Password</label>
<input type="password" class="form-control" placeholder="Your password" name="new_password1">
</div>
</div>
<div class="row form-group">
<div class="col-md-12 mb-3 mb-md-0">
<label class="font-weight-bold">Repeat password</label>
<input type="password" class="form-control" placeholder="Your password" name="new_password2">
</div>
</div>
<div class="row form-group">
<div class="col-md-12">
<input type="submit" value="Change" class="btn btn-primary py-2 px-5">
</div>
</div>
</form>
{% else %}
<h3>Your token is invalid.</h3>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,27 @@
{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="hero-wrap js-fullheight" style="background-image: url('{% static 'images/bg_2.jpg' %}');" data-stellar-background-ratio="0.5"> <div class="overlay"></div>
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Message</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Message</h1>
</div>
</div>
</div>
</div>
<div class="ftco-section bg-light">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-8 mb-5">
<p>Weve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.</p>
<p>If you dont receive an email, please make sure youve entered the address you registered with, and check your spam folder.</p>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,2 @@
Someone asked for password reset for email {{ email }}. Follow the link below:
{{ protocol}}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}

View File

@ -0,0 +1,56 @@
{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="hero-wrap js-fullheight" style="background-image: url('{% static 'images/bg_2.jpg' %}');" data-stellar-background-ratio="0.5"> <div class="overlay"></div>
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Remind password</span></p>
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Remind password</h1>
</div>
</div>
</div>
</div>
<div class="ftco-section bg-light">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-8 mb-5">
<form action="#" class="p-5 bg-white" method="post">
{% csrf_token %}
{% if form.errors %}
<div class="alert alert-danger alert-dismissible" role="alert">
<div id="form_errors">
{% for key, value in form.errors.items %}
<span class="fieldWrapper">
{{ key }}: {{ value }}
</span>
{% endfor %}
</div>
<button type="button" class="close" data-dismiss="alert" aria_hidden="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endif %}
<div class="row form-group">
<div class="col-md-12 mb-3 mb-md-0">
<label class="font-weight-bold">Email</label>
<input type="email" class="form-control" placeholder="Your email" name="email">
</div>
</div>
<div class="row form-group">
<div class="col-md-12">
<input type="submit" value="Send" class="btn btn-primary py-2 px-5">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -47,6 +47,8 @@
<div class="row form-group">
<div class="col-md-12">
<input type="submit" value="Login" class="btn btn-primary py-2 px-5">
<label class="font-weight-bold"><a href="{% url 'password_reset' %}">Reset password</a></label>
</div>
</div>
@ -60,26 +62,6 @@
{% endif %}
</div>
<div class="col-lg-4">
<div class="p-4 mb-3 bg-white">
<h3 class="h5 text-black mb-3">Contact Info</h3>
<p class="mb-0 font-weight-bold">Address</p>
<p class="mb-4">203 Fake St. Mountain View, San Francisco, California, USA</p>
<p class="mb-0 font-weight-bold">Phone</p>
<p class="mb-4"><a href="#">+1 232 3235 324</a></p>
<p class="mb-0 font-weight-bold">Email Address</p>
<p class="mb-0"><a href="#"><span class="__cf_email__" data-cfemail="671e081215020a060e0b2703080a060e094904080a">[email&#160;protected]</span></a></p>
</div>
<div class="p-4 mb-3 bg-white">
<h3 class="h5 text-black mb-3">More Info</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa ad iure porro mollitia architecto hic consequuntur. Distinctio nisi perferendis dolore, ipsa consectetur</p>
<p><a href="#" class="btn btn-primary py-2 px-4">Learn More</a></p>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,11 +1,14 @@
from django.urls import path
from .views import *
from django.contrib.auth import views as authViews
app_name = "users"
urlpatterns = [
path('register/', UserRegisterView.as_view(), name='register'),
path('login/', UserLoginView.as_view(), name='login'),
path('logout/', UserLogoutView.as_view(), name='logout'),
path('password-change/', authViews.PasswordChangeView.as_view(), name='password_change'),
path('password-change-done/', authViews.PasswordChangeDoneView.as_view(), name='password_change_done'),
path('update-profile/<int:pk>/', UserUpdateView.as_view(), name='update_profile'),
path('employee-profile/<int:employee_id>/<int:job_id>/', EmployeeProfileView.as_view(), name='employee_profile'),
path('employer-jobs/', EmployerPostedJobsView.as_view(), name='employer_jobs'),