39 | This broject is aimed at solving the nuances involved in creating a user authentication end to end with django and also
40 | shows how to create user profiles using signals
41 |
42 | Explore the docs »
43 |
44 |
45 | View Demo
46 | ·
47 | Report Bug
48 | ·
49 | Request Feature
50 |
51 |
52 |
53 |
54 |
55 |
56 | ## Table of Contents
57 |
58 | * [About the Project](#about-the-project)
59 | * [Built With](#built-with)
60 | * [Getting Started](#getting-started)
61 | * [Prerequisites](#prerequisites)
62 | * [Installation](#installation)
63 | * [Usage](#usage)
64 | * [Roadmap](#roadmap)
65 | * [Contributing](#contributing)
66 | * [License](#license)
67 | * [Contact](#contact)
68 | * [Acknowledgements](#acknowledgements)
69 |
70 |
71 |
72 |
73 | ## About The Project
74 |
75 | 
76 |
77 | ### Built With
78 |
79 | * python 3.8
80 | * django 3.0
81 | * django-bootstrap4
82 | * bootstrap4
83 | * fontawesome
84 |
85 |
86 |
87 |
88 | ## Getting Started
89 |
90 | To get a local copy up and running follow these simple steps.
91 |
92 | ### Prerequisites
93 | * pip
94 | ```sh
95 | download python
96 | ```
97 |
98 | ### Installation
99 |
100 | 1. Clone the repo
101 | ```sh
102 | git clone https://github.com/cforcross/User-Authentication-Web-App.git
103 | ```
104 | 2. Install requirements.txt
105 | ```sh
106 | pip install requirements.txt
107 | ```
108 |
109 | ## Usage
110 | ###### Project Dashboard
111 | 
112 |
113 | The above showcases the user dashboard after the given user has registerd and sign in, giving him/her the ability to Edit,and change passwords.And the sounds out.This takes
114 | then to the next page which gives them the ability to sign back into the application and if they can't remember their password,a password forgotten link is availalbe for
115 | them to then follow the steps inorde to reset their password
116 |
117 | _For more examples, please refer to the [Video demo](https://example.com)_
118 |
119 |
120 |
121 |
122 | ## Roadmap
123 |
124 | See the [open issues](https://github.com/cforcross/User-Authentication-Web-App/issues) for a list of proposed features (and known issues).
125 |
126 |
127 |
128 |
129 | ## Contributing
130 |
131 | Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
132 |
133 | 1. Fork the Project
134 | 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
135 | 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
136 | 4. Push to the Branch (`git push origin feature/AmazingFeature`)
137 | 5. Open a Pull Request
138 |
139 |
140 |
141 |
142 | ## License
143 |
144 | Distributed under the MIT License. See `LICENSE` for more information.
145 |
146 |
147 |
148 |
149 | ## Contact
150 |
151 | [@twitter_handle](https://twitter.com/chowacross)
152 |
153 | [github](https://github.com/cforcross/User-Authentication-Web-App.git)
154 |
155 |
156 | [linknd](https://www.linkedin.com/in/chowa-cross-4380a858/)
157 |
158 |
159 | [instagram](https://www.instagram.com/chowagroup/)
160 |
161 |
162 |
163 |
164 | ## Acknowledgements
165 | i'll begin by acknowledging the amazing guys at python,github and bootstrap,fontawesome the amazing work they do
166 | * [python](https://www.python.org/)
167 | * [Django](https://docs.djangoproject.com/en/3.1)
168 | * [fontawsome](https://fontawesome.com/)
169 | * [REadmetemplate](https://github.com/othneildrew/Best-README-Template)
170 | * [ Antonio Mele](https://www.packtpub.com/product/django-3-by-example-third-edition/9781838981952)
171 |
172 |
173 |
174 |
175 | [contributors-shield]: https://img.shields.io/github/contributors/cforcross/repo.svg?style=flat-square
176 | [contributors-url]: https://github.com/cforcross/repo/graphs/contributors
177 | [forks-shield]: https://img.shields.io/github/forks/cforcross/repo.svg?style=flat-square
178 | [forks-url]: https://github.com/cforcross/repo/network/members
179 | [stars-shield]: https://img.shields.io/github/stars/cforcross/repo.svg?style=flat-square
180 | [stars-url]: https://github.com/cforcross/repo/stargazers
181 | [issues-shield]: https://img.shields.io/github/issues/cforcross/repo.svg?style=flat-square
182 | [issues-url]: https://github.com/cforcross/repo/issues
183 | [license-shield]: https://img.shields.io/github/license/cforcross/repo.svg?style=flat-square
184 | [license-url]: https://github.com/cforcross/repo/blob/master/LICENSE.txt
185 | [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555
186 | [linkedin-url]: https://linkedin.com/in/cforcross
187 | [product-screenshot]: images/screenshot.png
188 |
189 |
190 |
191 |
192 |
193 |
--------------------------------------------------------------------------------
/authapp/__init__.py:
--------------------------------------------------------------------------------
1 | # loads the appconfig subclass
2 | default_app_config = 'authapp.apps.AuthappConfig'
3 |
--------------------------------------------------------------------------------
/authapp/__pycache__/__init__.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/__pycache__/__init__.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/__pycache__/admin.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/__pycache__/admin.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/__pycache__/apps.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/__pycache__/apps.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/__pycache__/forms.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/__pycache__/forms.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/__pycache__/models.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/__pycache__/models.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/__pycache__/signals.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/__pycache__/signals.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/__pycache__/urls.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/__pycache__/urls.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/__pycache__/views.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/__pycache__/views.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/authapp/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class AuthappConfig(AppConfig):
5 | name = 'authapp'
6 |
7 | def ready(self):
8 | from . import signals
9 |
--------------------------------------------------------------------------------
/authapp/forms.py:
--------------------------------------------------------------------------------
1 | from django.contrib.auth.models import User
2 | from django import forms
3 | # from .models import Profile
4 | from django.contrib.auth.forms import AuthenticationForm, UsernameField
5 | from .models import UserRegistrationModel
6 | from django.contrib.auth.forms import PasswordResetForm
7 |
8 |
9 | class UserRegistration(forms.ModelForm):
10 | password = forms.CharField(label='Password', widget=forms.PasswordInput)
11 | password2 = forms.CharField(
12 | label='Repeat Password', widget=forms.PasswordInput)
13 |
14 | class Meta:
15 | model = User
16 | fields = ('username', 'first_name', 'last_name', 'email')
17 |
18 | def clean_password2(self):
19 | cd = self.cleaned_data
20 | if cd['password'] != cd['password2']:
21 | raise forms.ValidationError('Passwords don\'t match.')
22 | return cd['password2']
23 |
24 |
25 | class UserEditForm(forms.ModelForm):
26 | class Meta:
27 | model = User
28 | fields = ('first_name', 'last_name', 'email')
29 |
30 |
31 |
--------------------------------------------------------------------------------
/authapp/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.1.2 on 2020-10-22 02:01
2 |
3 | from django.conf import settings
4 | from django.db import migrations, models
5 | import django.db.models.deletion
6 |
7 |
8 | class Migration(migrations.Migration):
9 |
10 | initial = True
11 |
12 | dependencies = [
13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14 | ]
15 |
16 | operations = [
17 | migrations.CreateModel(
18 | name='UserRegistrationModel',
19 | fields=[
20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21 | ('date_of_birth', models.DateTimeField()),
22 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
23 | ],
24 | ),
25 | ]
26 |
--------------------------------------------------------------------------------
/authapp/migrations/0002_auto_20201022_0503.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.1.2 on 2020-10-22 02:03
2 |
3 | from django.db import migrations, models
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | dependencies = [
9 | ('authapp', '0001_initial'),
10 | ]
11 |
12 | operations = [
13 | migrations.AlterField(
14 | model_name='userregistrationmodel',
15 | name='date_of_birth',
16 | field=models.DateTimeField(help_text='MM/DD/YYYY'),
17 | ),
18 | ]
19 |
--------------------------------------------------------------------------------
/authapp/migrations/0003_auto_20201022_0505.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.1.2 on 2020-10-22 02:05
2 |
3 | from django.db import migrations, models
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | dependencies = [
9 | ('authapp', '0002_auto_20201022_0503'),
10 | ]
11 |
12 | operations = [
13 | migrations.AlterField(
14 | model_name='userregistrationmodel',
15 | name='date_of_birth',
16 | field=models.DateTimeField(help_text='Please use the following format: YYYY-MM-DD.'),
17 | ),
18 | ]
19 |
--------------------------------------------------------------------------------
/authapp/migrations/0004_remove_userregistrationmodel_date_of_birth.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.1.2 on 2020-10-22 12:19
2 |
3 | from django.db import migrations
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | dependencies = [
9 | ('authapp', '0003_auto_20201022_0505'),
10 | ]
11 |
12 | operations = [
13 | migrations.RemoveField(
14 | model_name='userregistrationmodel',
15 | name='date_of_birth',
16 | ),
17 | ]
18 |
--------------------------------------------------------------------------------
/authapp/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/migrations/__init__.py
--------------------------------------------------------------------------------
/authapp/migrations/__pycache__/0001_initial.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/migrations/__pycache__/0001_initial.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/migrations/__pycache__/0002_auto_20201022_0503.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/migrations/__pycache__/0002_auto_20201022_0503.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/migrations/__pycache__/0003_auto_20201022_0505.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/migrations/__pycache__/0003_auto_20201022_0505.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/migrations/__pycache__/0004_remove_userregistrationmodel_date_of_birth.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/migrations/__pycache__/0004_remove_userregistrationmodel_date_of_birth.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/migrations/__pycache__/__init__.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cforcross/User-Authentication-Web-App/8223c5f9ab3b711aefa379d134a91cbbb8fab8d6/authapp/migrations/__pycache__/__init__.cpython-38.pyc
--------------------------------------------------------------------------------
/authapp/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 | from django.conf import settings
3 | # Create your models here.
4 |
5 |
6 | class UserRegistrationModel(models.Model):
7 | user = models.OneToOneField(
8 | settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
9 |
10 |
--------------------------------------------------------------------------------
/authapp/signals.py:
--------------------------------------------------------------------------------
1 | from django.db.models.signals import post_save
2 | from django.contrib.auth.models import User
3 | from django.dispatch import receiver
4 | from .models import UserRegistrationModel
5 |
6 |
7 | @receiver(post_save, sender=User)
8 | def creater_profile(sender, instance, created, **kwargs):
9 | if created:
10 | profile = UserRegistrationModel.objects.create(user=instance)
11 | profile.save()
12 |
--------------------------------------------------------------------------------
/authapp/templates/authapp/dashboard.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block title %}Dashboard{% endblock title %}
3 | {% block content %}
4 |