Skip to content

Commit f588ebe

Browse files
author
mominur-helios
committed
add authentication
1 parent 6e7b975 commit f588ebe

File tree

15 files changed

+633
-50
lines changed

15 files changed

+633
-50
lines changed

.gitignore

Lines changed: 159 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,160 @@
1-
*.pyc
2-
*.DS_Store
3-
*.egg*
4-
/dist/
5-
/.idea
6-
/docs/_build/
7-
/node_modules/
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
811
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
#.idea/

admin_argon/forms.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
from django import forms
2+
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, PasswordResetForm, UsernameField
3+
from django.contrib.auth.models import User
4+
from django.utils.translation import gettext_lazy as _
5+
6+
class RegistrationForm(UserCreationForm):
7+
password1 = forms.CharField(
8+
label=_("Password"),
9+
widget=forms.PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Password'}),
10+
)
11+
password2 = forms.CharField(
12+
label=_("Password Confirmation"),
13+
widget=forms.PasswordInput(attrs={'class': 'form-control', 'placeholder': 'Password Confirmation'}),
14+
)
15+
16+
class Meta:
17+
model = User
18+
fields = ('username', 'email', )
19+
20+
widgets = {
21+
'username': forms.TextInput(attrs={
22+
'class': 'form-control',
23+
'placeholder': 'Username'
24+
}),
25+
'email': forms.EmailInput(attrs={
26+
'class': 'form-control',
27+
'placeholder': 'Email'
28+
})
29+
}
30+
31+
class LoginForm(AuthenticationForm):
32+
username = UsernameField(widget=forms.TextInput(attrs={
33+
'class': 'form-control form-control-lg',
34+
'placeholder': 'Username'
35+
}))
36+
password = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
37+
'class': 'form-control form-control-lg',
38+
'placeholder': 'Password'
39+
}))
40+
41+
42+
class UserPasswordResetForm(PasswordResetForm):
43+
email = forms.EmailField(widget=forms.EmailInput(attrs={
44+
'class': 'form-control',
45+
'placeholder': 'Email'
46+
}))
47+
48+
class UserSetPasswordForm(SetPasswordForm):
49+
new_password1 = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
50+
'class': 'form-control',
51+
'placeholder': 'New Password'
52+
}), label="New Password")
53+
new_password2 = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
54+
'class': 'form-control',
55+
'placeholder': 'Confirm New Password'
56+
}), label="Confirm New Password")
57+
58+
59+
class UserPasswordChangeForm(PasswordChangeForm):
60+
old_password = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
61+
'class': 'form-control',
62+
'placeholder': 'Old Password'
63+
}), label='Old Password')
64+
new_password1 = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
65+
'class': 'form-control',
66+
'placeholder': 'New Password'
67+
}), label="New Password")
68+
new_password2 = forms.CharField(max_length=50, widget=forms.PasswordInput(attrs={
69+
'class': 'form-control',
70+
'placeholder': 'Confirm New Password'
71+
}), label="Confirm New Password")
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{% extends 'layouts/base-fullscreen.html' %}
2+
{% load i18n static admin_argon %}
3+
4+
{% block content %}
5+
6+
{% include 'includes/navigation-fullscreen.html' %}
7+
8+
<main class="main-content mt-0">
9+
<div class="page-header align-items-start min-vh-50 pt-5 pb-11 m-3 border-radius-lg" style="background-image: url('https://raw.githubusercontent.com/creativetimofficial/public-assets/master/argon-dashboard-pro/assets/img/signup-cover.jpg'); background-position: top;">
10+
<span class="mask bg-gradient-dark opacity-6"></span>
11+
<div class="container">
12+
<div class="row justify-content-center">
13+
<div class="col-lg-5 text-center mx-auto">
14+
<h1 class="text-white mb-2 mt-5">Welcome!</h1>
15+
<p class="text-lead text-white">Use these awesome forms to login or create new account in your project for free.</p>
16+
</div>
17+
</div>
18+
</div>
19+
</div>
20+
<div class="container">
21+
<div class="row mt-lg-n10 mt-md-n11 mt-n10 justify-content-center">
22+
<div class="col-xl-4 col-lg-5 col-md-7 mx-auto">
23+
<div class="card z-index-0">
24+
<div class="card-header text-center pt-4">
25+
<h5>Change Password</h5>
26+
</div>
27+
28+
<div class="card-body">
29+
<form method="post" action="#" role="form">
30+
{% csrf_token %}
31+
{% for field in form %}
32+
<div class="mb-3">
33+
{{field}}
34+
</div>
35+
<small>{{ field.errors }}</small>
36+
{% endfor %}
37+
<div class="text-center">
38+
<button type="submit" class="btn bg-gradient-dark w-100 my-4 mb-2">Change</button>
39+
</div>
40+
</form>
41+
</div>
42+
</div>
43+
</div>
44+
</div>
45+
</div>
46+
</main>
47+
{% include 'includes/footer-fullscreen.html' %}
48+
49+
{% endblock content %}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{% extends 'layouts/base-fullscreen.html' %}
2+
{% load i18n static admin_argon %}
3+
4+
{% block content %}
5+
6+
{% include 'includes/navigation-fullscreen.html' %}
7+
8+
<main class="main-content mt-0">
9+
<div class="page-header align-items-start min-vh-50 pt-5 pb-11 m-3 border-radius-lg" style="background-image: url('https://raw.githubusercontent.com/creativetimofficial/public-assets/master/argon-dashboard-pro/assets/img/signup-cover.jpg'); background-position: top;">
10+
<span class="mask bg-gradient-dark opacity-6"></span>
11+
<div class="container">
12+
<div class="row justify-content-center">
13+
<div class="col-lg-5 text-center mx-auto">
14+
<h1 class="text-white mb-2 mt-5">Welcome!</h1>
15+
<p class="text-lead text-white">Use these awesome forms to login or create new account in your project for free.</p>
16+
</div>
17+
</div>
18+
</div>
19+
</div>
20+
<div class="container">
21+
<div class="row mt-lg-n10 mt-md-n11 mt-n10 justify-content-center">
22+
<div class="col-xl-4 col-lg-5 col-md-7 mx-auto">
23+
<div class="card z-index-0">
24+
<div class="card-header text-center pt-4">
25+
<h5>Password Changed</h5>
26+
</div>
27+
28+
<div class="card-body">
29+
Your password has been changed successfully.
30+
</div>
31+
</div>
32+
</div>
33+
</div>
34+
</div>
35+
</main>
36+
{% include 'includes/footer-fullscreen.html' %}
37+
38+
{% endblock content %}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{% extends 'layouts/base-fullscreen.html' %}
2+
{% load i18n static admin_argon %}
3+
4+
{% block content %}
5+
6+
{% include 'includes/navigation-fullscreen.html' %}
7+
8+
<main class="main-content mt-0">
9+
<div class="page-header align-items-start min-vh-50 pt-5 pb-11 m-3 border-radius-lg" style="background-image: url('https://raw.githubusercontent.com/creativetimofficial/public-assets/master/argon-dashboard-pro/assets/img/signup-cover.jpg'); background-position: top;">
10+
<span class="mask bg-gradient-dark opacity-6"></span>
11+
<div class="container">
12+
<div class="row justify-content-center">
13+
<div class="col-lg-5 text-center mx-auto">
14+
<h1 class="text-white mb-2 mt-5">Welcome!</h1>
15+
<p class="text-lead text-white">Use these awesome forms to login or create new account in your project for free.</p>
16+
</div>
17+
</div>
18+
</div>
19+
</div>
20+
<div class="container">
21+
<div class="row mt-lg-n10 mt-md-n11 mt-n10 justify-content-center">
22+
<div class="col-xl-4 col-lg-5 col-md-7 mx-auto">
23+
<div class="card z-index-0">
24+
<div class="card-header text-center pt-4">
25+
<h5>Reset Password</h5>
26+
</div>
27+
28+
<div class="card-body">
29+
<form method="post" action="#" role="form">
30+
{% csrf_token %}
31+
{% for field in form %}
32+
<div class="mb-3">
33+
{{field}}
34+
</div>
35+
<small>{{ field.errors }}</small>
36+
{% endfor %}
37+
<div class="text-center">
38+
<button type="submit" class="btn bg-gradient-dark w-100 my-4 mb-2">Reset</button>
39+
</div>
40+
</form>
41+
</div>
42+
</div>
43+
</div>
44+
</div>
45+
</div>
46+
</main>
47+
{% include 'includes/footer-fullscreen.html' %}
48+
49+
{% endblock content %}

0 commit comments

Comments
 (0)