diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..82ba409
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+env
+**/.DS_Store
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..4c2e358
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,3 @@
+Django==2.2.5
+pytz==2019.2
+sqlparse==0.3.0
diff --git a/website/accounts/__init__.py b/website/accounts/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/website/accounts/__pycache__/__init__.cpython-37.pyc b/website/accounts/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000..4b70232
Binary files /dev/null and b/website/accounts/__pycache__/__init__.cpython-37.pyc differ
diff --git a/website/accounts/__pycache__/admin.cpython-37.pyc b/website/accounts/__pycache__/admin.cpython-37.pyc
new file mode 100644
index 0000000..a58498d
Binary files /dev/null and b/website/accounts/__pycache__/admin.cpython-37.pyc differ
diff --git a/website/accounts/__pycache__/apps.cpython-37.pyc b/website/accounts/__pycache__/apps.cpython-37.pyc
new file mode 100644
index 0000000..4323254
Binary files /dev/null and b/website/accounts/__pycache__/apps.cpython-37.pyc differ
diff --git a/website/accounts/__pycache__/forms.cpython-37.pyc b/website/accounts/__pycache__/forms.cpython-37.pyc
new file mode 100644
index 0000000..0808111
Binary files /dev/null and b/website/accounts/__pycache__/forms.cpython-37.pyc differ
diff --git a/website/accounts/__pycache__/models.cpython-37.pyc b/website/accounts/__pycache__/models.cpython-37.pyc
new file mode 100644
index 0000000..6640ffa
Binary files /dev/null and b/website/accounts/__pycache__/models.cpython-37.pyc differ
diff --git a/website/accounts/__pycache__/tokens.cpython-37.pyc b/website/accounts/__pycache__/tokens.cpython-37.pyc
new file mode 100644
index 0000000..0d00b3a
Binary files /dev/null and b/website/accounts/__pycache__/tokens.cpython-37.pyc differ
diff --git a/website/accounts/__pycache__/urls.cpython-37.pyc b/website/accounts/__pycache__/urls.cpython-37.pyc
new file mode 100644
index 0000000..5f4833a
Binary files /dev/null and b/website/accounts/__pycache__/urls.cpython-37.pyc differ
diff --git a/website/accounts/__pycache__/views.cpython-37.pyc b/website/accounts/__pycache__/views.cpython-37.pyc
new file mode 100644
index 0000000..e02bd67
Binary files /dev/null and b/website/accounts/__pycache__/views.cpython-37.pyc differ
diff --git a/website/accounts/admin.py b/website/accounts/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/website/accounts/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/website/accounts/apps.py b/website/accounts/apps.py
new file mode 100644
index 0000000..9b3fc5a
--- /dev/null
+++ b/website/accounts/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class AccountsConfig(AppConfig):
+ name = 'accounts'
diff --git a/website/accounts/forms.py b/website/accounts/forms.py
new file mode 100644
index 0000000..d676268
--- /dev/null
+++ b/website/accounts/forms.py
@@ -0,0 +1,11 @@
+from django import forms
+from django.contrib.auth.forms import UserCreationForm
+from django.contrib.auth.models import User
+
+
+class SignUpForm(UserCreationForm):
+ email = forms.EmailField(max_length=200, help_text='Required')
+
+ class Meta:
+ model = User
+ fields = ('username', 'email', 'password1', 'password2')
diff --git a/website/accounts/migrations/__init__.py b/website/accounts/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/website/accounts/migrations/__pycache__/__init__.cpython-37.pyc b/website/accounts/migrations/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000..292a8c8
Binary files /dev/null and b/website/accounts/migrations/__pycache__/__init__.cpython-37.pyc differ
diff --git a/website/accounts/models.py b/website/accounts/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/website/accounts/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/website/accounts/templates/accounts/acc_active_email.html b/website/accounts/templates/accounts/acc_active_email.html
new file mode 100644
index 0000000..afe40da
--- /dev/null
+++ b/website/accounts/templates/accounts/acc_active_email.html
@@ -0,0 +1,5 @@
+{% autoescape off %}
+Hi {{ user.username }},
+Please click on the link to confirm your registration,
+http://{{ domain }}{% url 'activate' uidb64=uid token=token %}
+{% endautoescape %}
diff --git a/website/accounts/templates/accounts/login.html b/website/accounts/templates/accounts/login.html
new file mode 100644
index 0000000..46236fd
--- /dev/null
+++ b/website/accounts/templates/accounts/login.html
@@ -0,0 +1,17 @@
+
+
+
+
+ Need An Account? Signup
+
+
+
diff --git a/website/accounts/templates/accounts/password-reset-complete.html b/website/accounts/templates/accounts/password-reset-complete.html
new file mode 100644
index 0000000..740106b
--- /dev/null
+++ b/website/accounts/templates/accounts/password-reset-complete.html
@@ -0,0 +1,3 @@
+
+ your password is reset.
+
diff --git a/website/accounts/templates/accounts/password-reset-confirm.html b/website/accounts/templates/accounts/password-reset-confirm.html
new file mode 100644
index 0000000..76c0eab
--- /dev/null
+++ b/website/accounts/templates/accounts/password-reset-confirm.html
@@ -0,0 +1,17 @@
+
diff --git a/website/accounts/templates/accounts/password-reset-done.html b/website/accounts/templates/accounts/password-reset-done.html
new file mode 100644
index 0000000..2443e8b
--- /dev/null
+++ b/website/accounts/templates/accounts/password-reset-done.html
@@ -0,0 +1,3 @@
+
+ An email has been sent. Please click on the link to reset your password
+
diff --git a/website/accounts/templates/accounts/password-reset.html b/website/accounts/templates/accounts/password-reset.html
new file mode 100644
index 0000000..76c0eab
--- /dev/null
+++ b/website/accounts/templates/accounts/password-reset.html
@@ -0,0 +1,17 @@
+
diff --git a/website/accounts/templates/accounts/signup.html b/website/accounts/templates/accounts/signup.html
new file mode 100644
index 0000000..86d8083
--- /dev/null
+++ b/website/accounts/templates/accounts/signup.html
@@ -0,0 +1,19 @@
+{% block content %}
+ Sign up
+
+{% endblock %}
diff --git a/website/accounts/tests.py b/website/accounts/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/website/accounts/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/website/accounts/tokens.py b/website/accounts/tokens.py
new file mode 100644
index 0000000..074849e
--- /dev/null
+++ b/website/accounts/tokens.py
@@ -0,0 +1,13 @@
+from django.contrib.auth.tokens import PasswordResetTokenGenerator
+from django.utils import six
+
+
+class TokenGenerator(PasswordResetTokenGenerator):
+ def _make_hash_value(self, user, timestamp):
+ return(
+ six.text_type(user.pk) + six.text_type(timestamp) +
+ six.text_type(user.is_active)
+ )
+
+
+account_activation_token = TokenGenerator()
diff --git a/website/accounts/urls.py b/website/accounts/urls.py
new file mode 100644
index 0000000..7f26e2d
--- /dev/null
+++ b/website/accounts/urls.py
@@ -0,0 +1,35 @@
+from django.urls import path
+from django.conf.urls import url
+from django.contrib.auth.views import (
+ LoginView, PasswordResetView, PasswordResetDoneView,
+ PasswordResetConfirmView, PasswordResetCompleteView
+)
+from . import views
+
+
+urlpatterns = [
+ url(r'^signup/$', views.signup, name='signup'),
+ url(r'^activate/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
+ views.activate, name='activate'),
+ path('login/', LoginView.as_view(template_name='accounts/login.html'), name='login'),
+ path(
+ 'password-reset/',
+ PasswordResetView.as_view(template_name='accounts/password-reset.html'),
+ name='password_reset'
+ ),
+ path(
+ 'password-reset/done/',
+ PasswordResetDoneView.as_view(template_name='accounts/password-reset-done.html'),
+ name='password_reset_done'
+ ),
+ path(
+ 'password-reset-confirm///',
+ PasswordResetConfirmView.as_view(template_name='accounts/password-reset-confirm.html'),
+ name='password_reset_confirm'
+ ),
+ path(
+ 'password-reset-complete',
+ PasswordResetCompleteView.as_view(template_name='accounts/password-reset-complete.html'),
+ name='password_reset_complete'
+ ),
+]
diff --git a/website/accounts/views.py b/website/accounts/views.py
new file mode 100644
index 0000000..c4e731f
--- /dev/null
+++ b/website/accounts/views.py
@@ -0,0 +1,52 @@
+from django.http import HttpResponse
+from django.shortcuts import render, redirect
+from .forms import SignUpForm
+from django.contrib.sites.shortcuts import get_current_site
+from django.utils.encoding import force_bytes, force_text
+from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
+from django.template.loader import render_to_string
+from .tokens import account_activation_token
+from django.contrib.auth.models import User
+from django.core.mail import EmailMessage
+
+
+def signup(request):
+ if request.method == 'POST':
+ form = SignUpForm(request.POST)
+ if form.is_valid():
+ user = form.save(commit=False)
+ user.is_active = False
+ user.save()
+ current_site = get_current_site(request)
+ mail_subject = 'Activate your blog account'
+ message = render_to_string(
+ 'accounts/acc_active_email.html', {
+ 'user': user,
+ 'domain': current_site.domain,
+ 'uid': urlsafe_base64_encode(force_bytes(user.pk)),
+ 'token': account_activation_token.make_token(user),
+ })
+ to_email = form.cleaned_data.get('email')
+ email = EmailMessage(
+ mail_subject, message, to=[to_email]
+ )
+ email.send()
+ return HttpResponse('Please confirm your email address to complete teh registration')
+ else:
+ form = SignUpForm()
+ return render(request, 'accounts/signup.html', {'form':form})
+
+
+def activate(request, uidb64, token):
+ try:
+ uid = force_text(urlsafe_base64_decode(uidb64))
+ user = User.objects.get(pk=uid)
+ except(TypeError, ValueError, OverflowError, User.DoesNotExist):
+ user = None
+ if user is not None and account_activation_token.check_token(user, token):
+ user.is_active = True
+ user.save()
+ login(request, user)
+ return HttpResponse('Thank you for your email confirmation. Now you can login your account.')
+ else:
+ return HttpResponse('Activation link is invalid!')
diff --git a/website/db.sqlite3 b/website/db.sqlite3
new file mode 100644
index 0000000..3f7f454
Binary files /dev/null and b/website/db.sqlite3 differ
diff --git a/website/manage.py b/website/manage.py
new file mode 100755
index 0000000..bb1dd90
--- /dev/null
+++ b/website/manage.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings')
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/website/website/__init__.py b/website/website/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/website/website/__pycache__/__init__.cpython-37.pyc b/website/website/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000..196c016
Binary files /dev/null and b/website/website/__pycache__/__init__.cpython-37.pyc differ
diff --git a/website/website/__pycache__/settings.cpython-37.pyc b/website/website/__pycache__/settings.cpython-37.pyc
new file mode 100644
index 0000000..dedc0b5
Binary files /dev/null and b/website/website/__pycache__/settings.cpython-37.pyc differ
diff --git a/website/website/__pycache__/urls.cpython-37.pyc b/website/website/__pycache__/urls.cpython-37.pyc
new file mode 100644
index 0000000..047d19f
Binary files /dev/null and b/website/website/__pycache__/urls.cpython-37.pyc differ
diff --git a/website/website/__pycache__/wsgi.cpython-37.pyc b/website/website/__pycache__/wsgi.cpython-37.pyc
new file mode 100644
index 0000000..b502e7a
Binary files /dev/null and b/website/website/__pycache__/wsgi.cpython-37.pyc differ
diff --git a/website/website/settings.py b/website/website/settings.py
new file mode 100644
index 0000000..240e9de
--- /dev/null
+++ b/website/website/settings.py
@@ -0,0 +1,116 @@
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '@mphmw*9dq_z+lth)k5+z1hen4)&o%0(9dsiy5w(aes@_^1n_='
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'accounts.apps.AccountsConfig',
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'website.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': ['templates'],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'website.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/2.2/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/2.2/howto/static-files/
+
+STATIC_URL = '/static/'
+
+# Email
+EMAIL_USE_TLS = True
+EMAIL_HOST = 'smtp.gmail.com'
+EMAIL_HOST_USER = 'your_mail_id@gmail.com'
+EMAIL_HOST_PASSWORD = 'your_password_or_app_password'
+EMAIL_PORT = 587
diff --git a/website/website/urls.py b/website/website/urls.py
new file mode 100644
index 0000000..e40cc0a
--- /dev/null
+++ b/website/website/urls.py
@@ -0,0 +1,7 @@
+from django.contrib import admin
+from django.urls import include, path
+
+urlpatterns = [
+ path('accounts/', include('accounts.urls')),
+ path('admin/', admin.site.urls),
+]
diff --git a/website/website/wsgi.py b/website/website/wsgi.py
new file mode 100644
index 0000000..140c5e8
--- /dev/null
+++ b/website/website/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for website project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings')
+
+application = get_wsgi_application()