-
Notifications
You must be signed in to change notification settings - Fork 981
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented forgot password feature.
- Loading branch information
1 parent
7d45b9c
commit 66508e7
Showing
9 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
FusionIIIT/applications/globals/migrations/0003_passwordresettracker.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 3.1.5 on 2025-01-01 15:10 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('globals', '0002_moduleaccess'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='PasswordResetTracker', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('email', models.EmailField(max_length=254, unique=True)), | ||
('last_reset', models.DateTimeField(blank=True, null=True)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
FusionIIIT/templates/registration/password_reset_complete.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Password Reset Successful</title> | ||
</head> | ||
<body> | ||
<h2>Password Reset Successful</h2> | ||
<p>Your password has been reset successfully. You can now log in with your new password.</p> | ||
<p><a href="/accounts/login/">Log In</a></p> | ||
</body> | ||
</html> |
63 changes: 63 additions & 0 deletions
63
FusionIIIT/templates/registration/password_reset_confirm.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{% extends "account/base.html" %} | ||
{% block content %} | ||
{% load i18n %} | ||
{% load account socialaccount %} | ||
{% load static semanticui %} | ||
|
||
<!-- <div class="content"> | ||
<img class="ui rounded centered small image" | ||
src="{% static 'globals/img/user.png' %}" | ||
style="margin-top: -27.5%; margin-left: 27.5%;" | ||
alt="User Image"> | ||
<div class="ui huge centered header"> | ||
Login | ||
</div> | ||
</div> --> | ||
|
||
<div class="content"> | ||
<div> | ||
<h2 style="margin-bottom: 10px; text-align: center;">Set New Password</h2> | ||
</div> | ||
<form method="POST" class="ui form" style="margin-top: 2.5%;margin-bottom: 2.5%;"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<button class = "fluid ui primary button" type="submit" style="margin-top: 20px;margin-bottom:10px">Reset Password</button> | ||
</form> | ||
</div> | ||
|
||
|
||
{% if form.errors %} | ||
<div id="error-popup" class="ui modal"> | ||
<div class="header">Reset Failed</div> | ||
<div class="content"> | ||
<ul> | ||
{% for field in form %} | ||
{% for error in field.errors %} | ||
<li>{{ error }}</li> | ||
{% endfor %} | ||
{% endfor %} | ||
{% for error in form.non_field_errors %} | ||
<li>{{ error }}</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
<div class="actions"> | ||
<div class="ui red ok button">OK</div> | ||
</div> | ||
</div> | ||
{% endif %} | ||
|
||
<script> | ||
document.addEventListener('DOMContentLoaded', function () { | ||
if (document.getElementById('error-popup')) { | ||
$('#error-popup').modal({ | ||
onApprove: function() { | ||
$('#error-popup').modal('hide'); | ||
} | ||
}).modal('show'); | ||
} | ||
}); | ||
</script> | ||
|
||
|
||
{% endblock %} |
13 changes: 13 additions & 0 deletions
13
FusionIIIT/templates/registration/password_reset_done.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Password Reset Sent</title> | ||
</head> | ||
<body> | ||
<h2>Check Your Email</h2> | ||
<p>If your email address is associated with an account, you will receive a password reset email shortly.</p> | ||
<p><a href="/">Back to Home</a></p> | ||
</body> | ||
</html> |
55 changes: 55 additions & 0 deletions
55
FusionIIIT/templates/registration/password_reset_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{% extends "account/base.html" %} | ||
{% block content %} | ||
{% load i18n %} | ||
{% load account socialaccount %} | ||
{% load static semanticui %} | ||
|
||
<!-- <div class="content"> | ||
<img class="ui rounded centered small image" | ||
src="{% static 'globals/img/user.png' %}" | ||
style="margin-top: -27.5%; margin-left: 27.5%;" | ||
alt="User Image"> | ||
<div class="ui huge centered header"> | ||
Login | ||
</div> | ||
</div> --> | ||
|
||
<div class="content"> | ||
<div> | ||
<h2 style="margin-bottom: 10px; text-align: center;">Forgot Your Password?</h2> | ||
<p style="text-align: center;">Enter your email address below, and we'll send you a link to reset your password.</p> | ||
</div> | ||
<form method="POST" class="ui form" style="margin-top: 2.5%;margin-bottom: 2.5%;"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<button class = "fluid ui primary button" type="submit" style="margin-top: 20px;margin-bottom:10px">Send Reset Link</button> | ||
</form> | ||
</div> | ||
|
||
{% if error_message %} | ||
<div id="error-popup" class="ui modal"> | ||
<div class="header">Reset Failed</div> | ||
<div class="content"> | ||
<ul> | ||
<li>{{ error_message }}</li> | ||
</ul> | ||
</div> | ||
<div class="actions"> | ||
<div class="ui red ok button">OK</div> | ||
</div> | ||
</div> | ||
{% endif %} | ||
|
||
<script> | ||
document.addEventListener('DOMContentLoaded', function () { | ||
if (document.getElementById('error-popup')) { | ||
$('#error-popup').modal({ | ||
onApprove: function() { | ||
$('#error-popup').modal('hide'); | ||
} | ||
}).modal('show'); | ||
} | ||
}); | ||
</script> | ||
|
||
{% endblock %} |