├── .gitignore ├── AuthenticationSyatem Django ├── AuthenticationSyatem │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── settings.cpython-38.pyc │ │ ├── urls.cpython-38.pyc │ │ └── wsgi.cpython-38.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── app │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── admin.cpython-38.pyc │ │ ├── apps.cpython-38.pyc │ │ ├── forms.cpython-38.pyc │ │ ├── models.cpython-38.pyc │ │ └── views.cpython-38.pyc │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-38.pyc │ ├── models.py │ ├── tests.py │ └── views.py ├── db.sqlite3 ├── manage.py └── templates │ ├── core.html │ ├── home.html │ ├── login.html │ └── register.html ├── AuthenticationSystemAjax ├── AuthenticationSystemAjax │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── app │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── db.sqlite3 ├── manage.py ├── static │ └── style.css └── templates │ ├── core.html │ ├── home.html │ └── login.html └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,django 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,django 4 | 5 | ### Django ### 6 | *.log 7 | *.pot 8 | *.pyc 9 | __pycache__/ 10 | local_settings.py 11 | 12 | 13 | # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ 14 | # in your Git repository. Update and uncomment the following line accordingly. 15 | # /staticfiles/ 16 | 17 | ### Django.Python Stack ### 18 | # Byte-compiled / optimized / DLL files 19 | *.py[cod] 20 | *$py.class 21 | 22 | # C extensions 23 | *.so 24 | 25 | # Distribution / packaging 26 | .Python 27 | build/ 28 | develop-eggs/ 29 | dist/ 30 | downloads/ 31 | eggs/ 32 | .eggs/ 33 | lib/ 34 | lib64/ 35 | parts/ 36 | sdist/ 37 | var/ 38 | wheels/ 39 | share/python-wheels/ 40 | *.egg-info/ 41 | .installed.cfg 42 | *.egg 43 | MANIFEST 44 | 45 | # PyInstaller 46 | # Usually these files are written by a python script from a template 47 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 48 | *.manifest 49 | *.spec 50 | 51 | # Installer logs 52 | pip-log.txt 53 | pip-delete-this-directory.txt 54 | 55 | # Unit test / coverage reports 56 | htmlcov/ 57 | .tox/ 58 | .nox/ 59 | .coverage 60 | .coverage.* 61 | .cache 62 | nosetests.xml 63 | coverage.xml 64 | *.cover 65 | *.py,cover 66 | .hypothesis/ 67 | .pytest_cache/ 68 | cover/ 69 | 70 | # Translations 71 | *.mo 72 | 73 | # Django stuff: 74 | 75 | # Flask stuff: 76 | instance/ 77 | .webassets-cache 78 | 79 | # Scrapy stuff: 80 | .scrapy 81 | 82 | # Sphinx documentation 83 | docs/_build/ 84 | 85 | # PyBuilder 86 | .pybuilder/ 87 | target/ 88 | 89 | # Jupyter Notebook 90 | .ipynb_checkpoints 91 | 92 | # IPython 93 | profile_default/ 94 | ipython_config.py 95 | 96 | # pyenv 97 | # For a library or package, you might want to ignore these files since the code is 98 | # intended to run in multiple environments; otherwise, check them in: 99 | # .python-version 100 | 101 | # pipenv 102 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 103 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 104 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 105 | # install all needed dependencies. 106 | #Pipfile.lock 107 | 108 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 109 | __pypackages__/ 110 | 111 | # Celery stuff 112 | celerybeat-schedule 113 | celerybeat.pid 114 | 115 | # SageMath parsed files 116 | *.sage.py 117 | 118 | # Environments 119 | .env 120 | .venv 121 | env/ 122 | venv/ 123 | ENV/ 124 | env.bak/ 125 | venv.bak/ 126 | 127 | # Spyder project settings 128 | .spyderproject 129 | .spyproject 130 | 131 | # Rope project settings 132 | .ropeproject 133 | 134 | # mkdocs documentation 135 | /site 136 | 137 | # mypy 138 | .mypy_cache/ 139 | .dmypy.json 140 | dmypy.json 141 | 142 | # Pyre type checker 143 | .pyre/ 144 | 145 | # pytype static type analyzer 146 | .pytype/ 147 | 148 | # Cython debug symbols 149 | cython_debug/ 150 | 151 | ### VisualStudioCode ### 152 | .vscode/* 153 | !.vscode/settings.json 154 | !.vscode/tasks.json 155 | !.vscode/launch.json 156 | !.vscode/extensions.json 157 | *.code-workspace 158 | 159 | # Local History for Visual Studio Code 160 | .history/ 161 | 162 | ### VisualStudioCode Patch ### 163 | # Ignore all local history of files 164 | .history 165 | .ionide 166 | 167 | ### Windows ### 168 | # Windows thumbnail cache files 169 | Thumbs.db 170 | Thumbs.db:encryptable 171 | ehthumbs.db 172 | ehthumbs_vista.db 173 | 174 | # Dump file 175 | *.stackdump 176 | 177 | # Folder config file 178 | [Dd]esktop.ini 179 | 180 | # Recycle Bin used on file shares 181 | $RECYCLE.BIN/ 182 | 183 | # Windows Installer files 184 | *.cab 185 | *.msi 186 | *.msix 187 | *.msm 188 | *.msp 189 | 190 | # Windows shortcuts 191 | *.lnk 192 | 193 | # End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,django -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/AuthenticationSyatem/__init__.py -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/AuthenticationSyatem/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/__pycache__/settings.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/AuthenticationSyatem/__pycache__/settings.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/AuthenticationSyatem/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/__pycache__/wsgi.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/AuthenticationSyatem/__pycache__/wsgi.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for AuthenticationSyatem project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'AuthenticationSyatem.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for AuthenticationSyatem project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.2.6. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.2/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'django-insecure-whatcbq^6u0efjstmibi!gziha8x6-cs=3a+4p9azwj_!+y!$7' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'app', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'AuthenticationSyatem.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [BASE_DIR/'templates'], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'AuthenticationSyatem.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/3.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': BASE_DIR / 'db.sqlite3', 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/3.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/3.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | 123 | # Default primary key field type 124 | # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field 125 | 126 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 127 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/urls.py: -------------------------------------------------------------------------------- 1 | """AuthenticationSyatem URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from app.views import home, register,loginFunc,logoutFun 19 | 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | path('register/',register,name='register'), 24 | path('',loginFunc,name='login'), 25 | path('logout/',logoutFun,name='logout'), 26 | path('home/',home,name='home'), 27 | ] 28 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/AuthenticationSyatem/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for AuthenticationSyatem project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'AuthenticationSyatem.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/__init__.py -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/__pycache__/admin.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/__pycache__/admin.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/__pycache__/apps.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/__pycache__/apps.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/__pycache__/forms.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/__pycache__/forms.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/__pycache__/models.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/__pycache__/models.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/__pycache__/views.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/__pycache__/views.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'app' 7 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.models import User 3 | from django.forms import fields 4 | from django.utils.translation import gettext_lazy as _ 5 | from django.contrib.auth.forms import UserCreationForm, UserChangeForm,AuthenticationForm,PasswordChangeForm,PasswordResetForm, UsernameField 6 | from django.core import validators 7 | 8 | def validete_username(value): 9 | if len(value)<=2: 10 | raise forms.ValidationError(f"Your username cannot be of {len(value)} word") 11 | 12 | class UserCreation(UserCreationForm): 13 | password1 = forms.CharField(label="Password", widget = forms.PasswordInput(attrs={"placeholder":"Password",'autocomplete':'new-password','class':'form-control'}),error_messages={"required":"Please enter password"},) 14 | password2 = forms.CharField(label="Re-enter",widget= forms.PasswordInput(attrs={"placeholder":"RE-Enter",'autocomplete':'new-password','class':'form-control'}),help_text="Make sure your password contains 'small letter','capital letter','numbers' and 'symbols'",error_messages={"required":"Re-Enter password field cannot be empty"}) 15 | username = forms.CharField(label="username",widget=forms.TextInput(attrs={"placeholder":"Username","id":"username",'class':'form-control'}),validators=[validete_username]) 16 | first_name = forms.CharField(widget=forms.TextInput(attrs={"placeholder":"First Name","required":True,'class':'form-control'}),error_messages={"required":"First name cannot be empty"}) 17 | last_name = forms.CharField(widget=forms.TextInput(attrs={"placeholder":"First Name","required":True,'class':'form-control'}),error_messages={"required":"Last name cannot be empty"}) 18 | email = forms.CharField(widget=forms.EmailInput(attrs={"required":True,"Placeholder":"Email",'autocomplete':'username','class':'form-control'})) 19 | class Meta: 20 | model = User 21 | fields =['username','email','first_name','last_name','password1','password2'] 22 | 23 | 24 | class LoginForm(AuthenticationForm): 25 | username = UsernameField(widget=forms.TextInput(attrs={"placeholder":"Username",'class':'form-control'})) 26 | password = forms.CharField(widget=forms.PasswordInput(attrs={"placeholder":"password",'autocomplete':'current-password','class':'form-control'})) 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/migrations/__init__.py -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/migrations/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/app/migrations/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/app/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import authenticate, forms, login, logout 2 | from django.shortcuts import render 3 | from .forms import UserCreation,LoginForm 4 | from django.contrib import messages 5 | from django.http import HttpResponseRedirect 6 | 7 | # Create your views here. 8 | def register(request): 9 | if not request.user.is_authenticated: 10 | if request.method == 'POST': 11 | form = UserCreation(request.POST) 12 | if form.is_valid(): 13 | form.save() 14 | messages.success(request, 'Account is created Successfully!') 15 | else: 16 | form = UserCreation() 17 | return render(request,'register.html',{'form':form}) 18 | else: 19 | return HttpResponseRedirect('/home/') 20 | 21 | 22 | def loginFunc(request): 23 | if not request.user.is_authenticated: 24 | if request.method == 'POST': 25 | form = LoginForm(request = request,data = request.POST) 26 | if form.is_valid(): 27 | username = form.cleaned_data['username'] 28 | pas = form.cleaned_data['password'] 29 | usr = authenticate(username= username,password=pas) 30 | login(request,usr) 31 | return HttpResponseRedirect('/home/') 32 | else: 33 | form = LoginForm() 34 | return render(request,'login.html',{'form':form}) 35 | else: 36 | return HttpResponseRedirect('/home/') 37 | 38 | def home(reqest): 39 | if reqest.user.is_authenticated: 40 | return render(reqest,'home.html') 41 | else: 42 | return HttpResponseRedirect('/') 43 | 44 | def logoutFun(request): 45 | logout(request) 46 | return HttpResponseRedirect('/') -------------------------------------------------------------------------------- /AuthenticationSyatem Django/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSyatem Django/db.sqlite3 -------------------------------------------------------------------------------- /AuthenticationSyatem Django/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'AuthenticationSyatem.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/templates/core.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Hello, world! 12 | 13 | 14 | {% block content %} 15 | 16 | {% endblock content %} 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /AuthenticationSyatem Django/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends 'core.html' %} 2 | {% block content %} 3 |
4 |
5 |
6 |

LOGOUT

7 |
8 |
9 |
10 | {% endblock content %} -------------------------------------------------------------------------------- /AuthenticationSyatem Django/templates/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'core.html' %} 2 | {% block content %} 3 |
4 |
5 |
6 |

Login

7 |
8 | {% csrf_token %} 9 | {{form}} 10 |
11 | 12 |
13 | 14 | Register 15 |
16 |
17 |
18 | {% endblock content %} -------------------------------------------------------------------------------- /AuthenticationSyatem Django/templates/register.html: -------------------------------------------------------------------------------- 1 | {% extends 'core.html' %} 2 | {% block content %} 3 |
4 |
5 |
6 |

Register

7 |
8 | {% csrf_token %} 9 | {{form}} 10 |
11 | 12 |
13 |
14 | Login 15 |
16 |
17 | {% if messages %} 18 | {% for message in messages %} 19 | 23 | {% endfor %} 24 | {% endif %} 25 |
26 | 27 |
28 |
29 |
30 | {% endblock content %} -------------------------------------------------------------------------------- /AuthenticationSystemAjax/AuthenticationSystemAjax/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSystemAjax/AuthenticationSystemAjax/__init__.py -------------------------------------------------------------------------------- /AuthenticationSystemAjax/AuthenticationSystemAjax/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for AuthenticationSystemAjax project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'AuthenticationSystemAjax.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/AuthenticationSystemAjax/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for AuthenticationSystemAjax project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.2.6. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.2/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'django-insecure-oesb#43&m(e9wht&lo(ekp03e__cb4ha35gwg9s788*+l8ss!u' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'app' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'AuthenticationSystemAjax.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [BASE_DIR/'templates'], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'AuthenticationSystemAjax.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/3.2/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': BASE_DIR / 'db.sqlite3', 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/3.2/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/3.2/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | 123 | # Default primary key field type 124 | # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field 125 | 126 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 127 | STATICFILES_DIRS = [BASE_DIR / "static"] -------------------------------------------------------------------------------- /AuthenticationSystemAjax/AuthenticationSystemAjax/urls.py: -------------------------------------------------------------------------------- 1 | """AuthenticationSystemAjax URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from app.views import logoutFun,home,main,signup_ajax_function,signin_ajax_function 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('reg/',signup_ajax_function,name='reg'), 23 | path('login/',signin_ajax_function,name='login'), 24 | path('',main,name='main'), 25 | path('home/',home,name='home'), 26 | path('logout/',logoutFun,name='logout'), 27 | ] 28 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/AuthenticationSystemAjax/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for AuthenticationSystemAjax project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'AuthenticationSystemAjax.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSystemAjax/app/__init__.py -------------------------------------------------------------------------------- /AuthenticationSystemAjax/app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'app' 7 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/app/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.models import User 3 | from django.forms import fields 4 | from django.utils.translation import gettext_lazy as _ 5 | from django.contrib.auth.forms import UserCreationForm, UserChangeForm,AuthenticationForm,PasswordChangeForm,PasswordResetForm, UsernameField 6 | from django.core import validators 7 | 8 | def validete_username(value): 9 | if len(value)<=2: 10 | raise forms.ValidationError(f"Your username cannot be of {len(value)} word") 11 | 12 | class UserCreationForm(UserCreationForm): 13 | password1 = forms.CharField(label="Password", widget = forms.PasswordInput(attrs={"placeholder":"Password",'autocomplete':'new-password','class':'form-control input'}),error_messages={"required":"Please enter password"},) 14 | password2 = forms.CharField(label="Re-enter",widget= forms.PasswordInput(attrs={"placeholder":"Re-Enter Password",'autocomplete':'new-password','class':'form-control input'}),help_text="Make sure your password contains 'small letter','capital letter','numbers' and 'symbols'",error_messages={"required":"Re-Enter password field cannot be empty"}) 15 | username = forms.CharField(label="username",widget=forms.TextInput(attrs={"placeholder":"Username","id":"username",'class':'form-control input'}),validators=[validete_username]) 16 | first_name = forms.CharField(widget=forms.TextInput(attrs={"placeholder":"First Name","required":True,'class':'form-control input'}),error_messages={"required":"First name cannot be empty"}) 17 | last_name = forms.CharField(widget=forms.TextInput(attrs={"placeholder":"First Name","required":True,'class':'form-control input'}),error_messages={"required":"Last name cannot be empty"}) 18 | email = forms.CharField(widget=forms.EmailInput(attrs={"required":True,"Placeholder":"Email",'autocomplete':'username','class':'form-control input'})) 19 | class Meta: 20 | model = User 21 | fields =['username','email','first_name','last_name','password1','password2'] 22 | 23 | 24 | class LoginForm(AuthenticationForm): 25 | username = UsernameField(widget=forms.TextInput(attrs={"placeholder":"Username",'class':'form-control input'})) 26 | password = forms.CharField(widget=forms.PasswordInput(attrs={"placeholder":"password",'autocomplete':'current-password','class':'form-control input'})) 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/app/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSystemAjax/app/migrations/__init__.py -------------------------------------------------------------------------------- /AuthenticationSystemAjax/app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/app/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import authenticate, forms, login, logout 2 | from django.shortcuts import render 3 | from .forms import UserCreationForm,LoginForm 4 | from django.contrib import messages 5 | from django.http import HttpResponseRedirect 6 | from django.http import JsonResponse 7 | from django.contrib.auth.models import User 8 | 9 | 10 | # Create your views here. 11 | def signup_ajax_function(request): 12 | if request.method == 'POST': 13 | form = UserCreationForm(request.POST) 14 | email = request.POST.get('email') 15 | fname = request.POST.get('first_name') 16 | 17 | if form.is_valid(): 18 | if User.objects.filter(email=email).exists(): 19 | return JsonResponse({"error_email":"Email already exists"}) 20 | else: 21 | form.save() 22 | return JsonResponse({"status":200}) 23 | else: 24 | error_name =[] 25 | error_value = [] 26 | for i,j in form.errors.as_data().items(): 27 | print(i,j[0]) 28 | for m in j[0]: 29 | error_value.append(m) 30 | error_name.append(i) 31 | 32 | print(form.errors.as_data()) 33 | error = form.errors.as_data() 34 | return JsonResponse({"status":"errors","error_name":error_name,"error_value":error_value}) 35 | else: 36 | return JsonResponse({"status":"Failed"}) 37 | 38 | 39 | 40 | def signin_ajax_function(request): 41 | if request.method == 'POST': 42 | form = LoginForm(request=request,data=request.POST) 43 | if form.is_valid(): 44 | username = form.cleaned_data['username'] 45 | pas = form.cleaned_data['password'] 46 | try: 47 | usr = authenticate(username=username,password = pas) 48 | except: 49 | return JsonResponse({'status':203}) 50 | login(request,usr) 51 | return JsonResponse({'status':200}) 52 | 53 | else: 54 | error_name =[] 55 | error_value = [] 56 | for i,j in form.errors.as_data().items(): 57 | print(i,j[0]) 58 | for m in j[0]: 59 | error_value.append(m) 60 | error_name.append(i) 61 | 62 | print(form.errors.as_data()) 63 | error = form.errors.as_data() 64 | return JsonResponse({"status":"errors","error_name":error_name,"error_value":error_value}) 65 | else: 66 | return JsonResponse({"status":"Failed"}) 67 | 68 | 69 | 70 | def main(reqest): 71 | userCreation = UserCreationForm() 72 | loginForm = LoginForm() 73 | return render(reqest,'login.html',{'userCreation':userCreation,'loginForm':loginForm}) 74 | 75 | 76 | def home(reqest): 77 | if reqest.user.is_authenticated: 78 | return render(reqest,'home.html') 79 | else: 80 | return HttpResponseRedirect('/') 81 | 82 | 83 | 84 | def logoutFun(request): 85 | logout(request) 86 | return HttpResponseRedirect('/') -------------------------------------------------------------------------------- /AuthenticationSystemAjax/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srksuman/User-authentication-in-Django---Ajax-Jquery/4ac92894f48b965ded9831bcfb9b7595c8934d6d/AuthenticationSystemAjax/db.sqlite3 -------------------------------------------------------------------------------- /AuthenticationSystemAjax/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'AuthenticationSystemAjax.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/static/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | color: #6a6f8c; 4 | background: #c8c8c8; 5 | font: 600 16px/18px 'Open Sans', sans-serif 6 | } 7 | 8 | .login-box { 9 | width: 100%; 10 | margin: auto; 11 | max-width: 525px; 12 | min-height: 670px; 13 | position: relative; 14 | background: url(https://images.unsplash.com/photo-1507208773393-40d9fc670acf?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1268&q=80) no-repeat center; 15 | box-shadow: 0 12px 15px 0 rgba(0, 0, 0, .24), 0 17px 50px 0 rgba(0, 0, 0, .19) 16 | } 17 | 18 | .login-snip { 19 | width: 100%; 20 | height: 100%; 21 | position: absolute; 22 | padding: 90px 70px 50px 70px; 23 | background: rgba(0, 77, 77, .9) 24 | } 25 | 26 | .login-snip .login, 27 | .login-snip .sign-up-form { 28 | top: 0; 29 | left: 0; 30 | right: 0; 31 | bottom: 0; 32 | position: absolute; 33 | transform: rotateY(180deg); 34 | backface-visibility: hidden; 35 | transition: all .4s linear 36 | } 37 | 38 | .login-snip .sign-in, 39 | .login-snip .sign-up, 40 | .login-space .group .check { 41 | display: none 42 | } 43 | 44 | .login-snip .tab, 45 | .login-space .group .label, 46 | .login-space .group .button { 47 | text-transform: uppercase 48 | } 49 | 50 | .login-snip .tab { 51 | font-size: 22px; 52 | margin-right: 15px; 53 | padding-bottom: 5px; 54 | margin: 0 15px 10px 0; 55 | display: inline-block; 56 | border-bottom: 2px solid transparent 57 | } 58 | 59 | .login-snip .sign-in:checked+.tab, 60 | .login-snip .sign-up:checked+.tab { 61 | color: #fff; 62 | border-color: #1161ee 63 | } 64 | 65 | .login-space { 66 | min-height: 345px; 67 | position: relative; 68 | perspective: 1000px; 69 | transform-style: preserve-3d 70 | } 71 | 72 | .login-space .group { 73 | margin-bottom: 15px 74 | } 75 | 76 | .login-space .group .label, 77 | .login-space .group .input, 78 | .login-space .group .button { 79 | width: 100%; 80 | color: #fff; 81 | display: block 82 | } 83 | 84 | .login-space .group .input, 85 | .login-space .group .button { 86 | border: none; 87 | padding: 15px 20px; 88 | border-radius: 25px; 89 | background: rgba(255, 255, 255, .1) 90 | } 91 | 92 | .login-space .group input[data-type="password"] { 93 | text-security: circle; 94 | -webkit-text-security: circle 95 | } 96 | 97 | .login-space .group .label { 98 | color: #aaa; 99 | font-size: 12px 100 | } 101 | 102 | .login-space .group .button { 103 | background: #1161ee 104 | } 105 | 106 | .login-space .group label .icon { 107 | width: 15px; 108 | height: 15px; 109 | border-radius: 2px; 110 | position: relative; 111 | display: inline-block; 112 | background: rgba(255, 255, 255, .1) 113 | } 114 | 115 | .login-space .group label .icon:before, 116 | .login-space .group label .icon:after { 117 | content: ''; 118 | width: 10px; 119 | height: 2px; 120 | background: #fff; 121 | position: absolute; 122 | transition: all .2s ease-in-out 0s 123 | } 124 | 125 | .login-space .group label .icon:before { 126 | left: 3px; 127 | width: 5px; 128 | bottom: 6px; 129 | transform: scale(0) rotate(0) 130 | } 131 | 132 | .login-space .group label .icon:after { 133 | top: 6px; 134 | right: 0; 135 | transform: scale(0) rotate(0) 136 | } 137 | 138 | .login-space .group .check:checked+label { 139 | color: #fff 140 | } 141 | 142 | .login-space .group .check:checked+label .icon { 143 | background: #1161ee 144 | } 145 | 146 | .login-space .group .check:checked+label .icon:before { 147 | transform: scale(1) rotate(45deg) 148 | } 149 | 150 | .login-space .group .check:checked+label .icon:after { 151 | transform: scale(1) rotate(-45deg) 152 | } 153 | 154 | .login-snip .sign-in:checked+.tab+.sign-up+.tab+.login-space .login { 155 | transform: rotate(0) 156 | } 157 | 158 | .login-snip .sign-up:checked+.tab+.login-space .sign-up-form { 159 | transform: rotate(0) 160 | } 161 | 162 | *, 163 | :after, 164 | :before { 165 | box-sizing: border-box 166 | } 167 | 168 | .clearfix:after, 169 | .clearfix:before { 170 | content: ''; 171 | display: table 172 | } 173 | 174 | .clearfix:after { 175 | clear: both; 176 | display: block 177 | } 178 | 179 | a { 180 | color: inherit; 181 | text-decoration: none 182 | } 183 | 184 | .hr { 185 | height: 2px; 186 | margin: 60px 0 50px 0; 187 | background: rgba(255, 255, 255, .2) 188 | } 189 | 190 | .foot { 191 | text-align: center 192 | } 193 | 194 | .card { 195 | width: 500px; 196 | left: 100px 197 | } 198 | 199 | ::placeholder { 200 | color: #b3b3b3 201 | } -------------------------------------------------------------------------------- /AuthenticationSystemAjax/templates/core.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Hello, world! 12 | 13 | 14 | {% block content %} 15 | 16 | {% endblock content %} 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /AuthenticationSystemAjax/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends 'core.html' %} 2 | {% block content %} 3 |
4 |
5 |
6 |

LOGOUT

7 |
8 |
9 |
10 | {% endblock content %} -------------------------------------------------------------------------------- /AuthenticationSystemAjax/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% load static %} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Login 13 | 14 | 15 |
16 |
17 |
18 | 75 |
76 |
77 |
78 | 79 | 80 | 81 | 180 | 181 | 261 | 262 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # User Authentication In Django/Ajax/Jquery 2 | # Demo: Authentication System Using Django/Ajax/Jquery 3 | ![ajax](https://user-images.githubusercontent.com/67781881/132255146-7ec7ec6d-307d-4e14-b4a9-3ba8813c8b1d.gif) 4 | # Demo: Authentication System Using Django 5 | ![normal](https://user-images.githubusercontent.com/67781881/132255095-4123af41-ee2f-4fa6-bf35-ac3dd171e516.gif) 6 | 7 | Overview 8 | The Django authentication system handles both authentication and authorization. 9 | Briefly, authentication verifies a user is who they claim to be, and authorization 10 | determines what an authenticated user is allowed to do. Here the term authentication 11 | is used to refer to both tasks. 12 | ## The auth system consists of: 13 | * Users 14 | * Permissions: Binary (yes/no) flags designating whether a user may perform a certain task. 15 | * Groups: A generic way of applying labels and permissions to more than one user. 16 | * A configurable password hashing system 17 | * Forms and view tools for logging in users, or restricting content 18 | * A pluggable backend system 19 |
20 | The authentication system in Django aims to be very generic and doesn’t provide some features commonly found in web authentication systems. Solutions for some of these common problems have been implemented in third-party packages: 21 | 22 | * Password strength checking 23 | * Throttling of login attempts 24 | * Authentication against third-parties (OAuth, for example) 25 | * Object-level permissions 26 | --------------------------------------------------------------------------------