django-chat-application / templates /password /password_reset_form.html
devnamdev2003
up3
727a40a
{% extends '../base.html' %}
{% load static %}
{% block title %}
Forgot Password
{% endblock %}
{% block style %}
<style>
* {
margin: 0%;
padding: 0%;
box-sizing: border-box;
}
body {
background-color: #131518;
font-family: century gothic;
}
.container {
max-width: 500px;
margin: auto;
padding: 30px;
position: relative;
top: 30px;
background-color: #282a2d;
border: 2px solid rgb(255, 132, 0);
text-align: center;
border-radius: 8px;
box-shadow: 4px 4px 10px -4px #9339f5;
}
@media screen and (max-width: 550px) {
.container {
top: 30px;
max-width: 550px;
}
}
#title {
color: #fff;
font-size: 32px;
margin-top: 40px;
margin-bottom: 40px;
}
form {
width: 80%;
margin: 0px auto;
}
#login-fields {
width: 100%;
}
#login-fields input {
margin-bottom: 20px;
padding: 15px 15px;
width: 100%; /* text-align: center; */
color: #fff;
font-size: 16px;
background: #131518;
border-radius: 8px;
outline: none;
border: none;
}
::placeholder {
color: #7a7a7a;
opacity: 1;
}
#password-relative {
display: flex;
align-items: center;
text-align: center;
justify-content: center;
margin-bottom: 20px;
text-align: left;
}
#password-relative a {
transition-duration: 0.2s;
color: #9339f5;
text-decoration: none;
font-size: 20px;
font-weight: 400;
outline: none;
}
#password-relative a:hover,
#password-relative a:focus {
transition-duration: 0.2s;
color: #a57df5;
}
button {
margin-bottom: 6px;
width: 50%;
color: #fff;
font-size: 20px;
background: #9339f5;
border: none;
border-radius: 8px;
outline: none;
cursor: pointer;
padding: 13px 0px;
}
button:hover {
transition-duration: 0.2s;
background: #6421eb;
}
.message {
width: 80%;
margin: 0px auto;
color: #f53939;
font-size: 18px;
}
.message:hover {
transition-duration: 0.2s;
color: #f57d7d;
}
div.mess h1 {
font-weight: 500;
line-height: 1.2;
color: #dc3545;
font-size: 36px;
margin-bottom: 20px;
}
div.mess p {
color: aliceblue;
font-size: 18px;
margin-bottom: 30px;
}
@media screen and (max-width: 550px) {
form {
width: 90%;
}
}
</style>
{% endblock %}
{% block content %}
<div class="container">
<div id="header">
<div id="title">Forgot Password</div>
</div>
<form method="post" onsubmit="return handleLogin(event)">
{% csrf_token %}
<div id="login-fields">
<input type="email" name="email" autocomplete="email" maxlength="254" required="" id="id_email" placeholder="Enter email" />
</div>
<button type="submit" id="reset-btn">
<span id="btn-text">Submit</span>
<span id="loader" class="hidden"></span>
</button>
</form>
<br>
{% if form.errors %}
{% for field, errors in form.errors.items %}
{% for error in errors %}
<p class="message">{{ error }}</p>
{% endfor %}
{% endfor %}
{% endif %}
</div>
<script>
document.getElementById('emailForm').addEventListener('submit', function () {
document.getElementById('reset').disabled = true // Disable the submit button
})
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href)
}
function handleLogin(event) {
const resetButton = document.getElementById('reset-btn')
const btnText = document.getElementById('btn-text')
const loader = document.getElementById('loader')
// Disable button and show loader
resetButton.disabled = true
btnText.style.display = 'none'
loader.classList.remove('hidden')
loader.innerHTML = '<div class="spinner"></div>' // Add spinner content
// Allow the form to submit
return true
}
window.addEventListener('pageshow', () => {
const resetButton = document.getElementById('reset-btn')
const btnText = document.getElementById('btn-text')
const loader = document.getElementById('loader')
// Reset the button and loader states
resetButton.disabled = false
btnText.style.display = 'inline'
loader.classList.add('hidden')
})
</script>
{% endblock %}