Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified College/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file modified College/__pycache__/settings.cpython-310.pyc
Binary file not shown.
Binary file modified College/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file modified College/__pycache__/wsgi.cpython-310.pyc
Binary file not shown.
44 changes: 43 additions & 1 deletion College/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'home.apps.HomeConfig',

'widget_tweaks',
# allauth apps
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',


]

MIDDLEWARE = [
Expand Down Expand Up @@ -131,4 +141,36 @@

STATIC_ROOT = BASE_DIR / 'staticfiles'
JAZZMIN_SETTINGS = JAZZMIN_SETTINGS
JAZZMIN_UI_TWEAKS = JAZZMIN_UI_TWEAKS
JAZZMIN_UI_TWEAKS = JAZZMIN_UI_TWEAKS

###### All Auth Settings #####

AUTHENTICATION_BACKENDS = [
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',

# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
]

SITE_ID = 2 # for 127.0.0.1:8000

SOCIALACCOUNT_PROVIDERS = {
'google': {
'SCOPE': [
'profile',
'email',
],
'AUTH_PARAMS': {
'access_type': 'online',
},
'OAUTH_PKCE_ENABLED': True,
}
}

LOGIN_REDIRECT_URL = '/dashboard/'

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
ACCOUNT_EMAIL_VERIFICATION = "none"

ACCOUNT_LOGOUT_ON_GET = True
10 changes: 1 addition & 9 deletions College/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('allauth.urls')), # all auth
path('',include('home.urls')),
path('login',include('home.urls')),
path('purchase',include('home.urls')),
path('register',include('home.urls')),
path('dashboard',include('home.urls')),
path('search_result',include('home.urls')),
path('kiet_page',include('home.urls')),
path('done',include('home.urls')),
path('profile_settings',include('home.urls')),
path('save',include('home.urls')),
]
Binary file modified db.sqlite3
Binary file not shown.
Binary file modified home/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file modified home/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file modified home/__pycache__/apps.cpython-310.pyc
Binary file not shown.
Binary file modified home/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file modified home/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file modified home/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file modified home/migrations/__pycache__/0001_initial.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file modified home/migrations/__pycache__/0003_alter_data_img.cpython-310.pyc
Binary file not shown.
Binary file modified home/migrations/__pycache__/0004_studentdata.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file modified home/migrations/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
17 changes: 8 additions & 9 deletions home/urls.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
from django.contrib import admin
from django.urls import path
from home import views

urlpatterns = [
path("", views.index , name ="home"),
path("login", views.login , name ="login"),
path("purchase", views.purchase , name ="purchase"),
path("register", views.register , name ="register"),
path("dashboard", views.dashboard , name ="dashboard"),
path("login/", views.login , name ="login"),
path("purchase/", views.purchase , name ="purchase"),
path("register/", views.register , name ="register"),
path("dashboard/", views.dashboard , name ="dashboard"),
path("search/", views.search_result , name ="search"),
path("kiet_page", views.kiet_page , name ="kiet_page"),
path("done", views.done , name ="done"),
path("profile_settings", views.profile_settings , name ="profile_settings"),
path("save", views.save , name ="save"),
path("kiet_page/", views.kiet_page , name ="kiet_page"),
path("done/", views.done , name ="done"),
path("profile_settings/", views.profile_settings , name ="profile_settings"),
path("save/", views.save , name ="save"),
]
6 changes: 5 additions & 1 deletion home/views.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import email
import http
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from .models import Data
from .models import StudentData
from django.db.models import Q

# Create your views here.
def index(request):
if request.user.is_authenticated:
return redirect('/dashboard/')
return render(request , 'index.html')

def login(request):
Expand All @@ -18,6 +21,7 @@ def purchase(request):
def register(request):
return render(request , 'register.html')

@login_required(login_url="/accounts/login/")
def dashboard(request):
return render(request , 'dashboard.html')

Expand Down
16 changes: 16 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
asgiref==3.5.2
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.0.1
cryptography==39.0.0
defusedxml==0.7.1
Django==4.1.1
django-allauth==0.52.0
django-jazzmin==2.6.0
django-widget-tweaks==1.4.12
idna==3.4
oauthlib==3.2.2
pycparser==2.21
PyJWT==2.6.0
python3-openid==3.2.0
requests==2.28.2
requests-oauthlib==1.3.1
sqlparse==0.4.2
tzdata==2022.2
urllib3==1.26.14
Binary file added static/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions templates/account/account_inactive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends "account/base.html" %}

{% load i18n %}

{% block head_title %}{% trans "Account Inactive" %}{% endblock %}

{% block content %}
<h1>{% trans "Account Inactive" %}</h1>

<p>{% trans "This account is inactive." %}</p>
{% endblock %}
42 changes: 42 additions & 0 deletions templates/account/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block head_title %}{% endblock %}</title>
{% block extra_head %}
{% endblock %}
</head>
<body>
{% block body %}

{% if messages %}
<div>
<strong>Messages:</strong>
<ul>
{% for message in messages %}
<li>{{message}}</li>
{% endfor %}
</ul>
</div>
{% endif %}

<div>
<strong>Menu:</strong>
<ul>
{% if user.is_authenticated %}
<li><a href="{% url 'account_email' %}">Change E-mail</a></li>
<li><a href="{% url 'account_logout' %}">Sign Out</a></li>
{% else %}
<li><a href="{% url 'account_login' %}">Sign In</a></li>
<li><a href="{% url 'account_signup' %}">Sign Up</a></li>
{% endif %}
</ul>
</div>
{% block content %}
{% endblock %}
{% endblock %}
{% block extra_body %}
{% endblock %}
</body>
</html>
74 changes: 74 additions & 0 deletions templates/account/email.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{% extends "account/base.html" %}

{% load i18n %}

{% block head_title %}{% trans "E-mail Addresses" %}{% endblock %}

{% block content %}
<h1>{% trans "E-mail Addresses" %}</h1>
{% if user.emailaddress_set.all %}
<p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>

<form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<fieldset class="blockLabels">

{% for emailaddress in user.emailaddress_set.all %}
<div class="ctrlHolder">
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">

<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{%endif %} value="{{emailaddress.email}}"/>

{{ emailaddress.email }}
{% if emailaddress.verified %}
<span class="verified">{% trans "Verified" %}</span>
{% else %}
<span class="unverified">{% trans "Unverified" %}</span>
{% endif %}
{% if emailaddress.primary %}<span class="primary">{% trans "Primary" %}</span>{% endif %}
</label>
</div>
{% endfor %}

<div class="buttonHolder">
<button class="secondaryAction" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
<button class="secondaryAction" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
<button class="primaryAction" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
</div>

</fieldset>
</form>

{% else %}
<p><strong>{% trans 'Warning:'%}</strong> {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>

{% endif %}

{% if can_add_email %}
<h2>{% trans "Add E-mail Address" %}</h2>

<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{{ form.as_p }}
<button name="action_add" type="submit">{% trans "Add E-mail" %}</button>
</form>
{% endif %}

{% endblock %}


{% block extra_body %}
<script type="text/javascript">
(function() {
var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {
if (! confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
{% endblock %}
13 changes: 13 additions & 0 deletions templates/account/email/account_already_exists_message.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends "account/email/base_message.txt" %}
{% load i18n %}

{% block content %}{% autoescape off %}{% blocktrans %}You are receiving this e-mail because you or someone else tried to signup for an
account using e-mail address:

{{ email }}

However, an account using that e-mail address already exists. In case you have
forgotten about this, please use the password forgotten procedure to recover
your account:

{{ password_reset_url }}{% endblocktrans %}{% endautoescape %}{% endblock %}
4 changes: 4 additions & 0 deletions templates/account/email/account_already_exists_subject.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Account Already Exists{% endblocktrans %}
{% endautoescape %}
7 changes: 7 additions & 0 deletions templates/account/email/base_message.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name %}Hello from {{ site_name }}!{% endblocktrans %}

{% block content %}{% endblock %}

{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you for using {{ site_name }}!
{{ site_domain }}{% endblocktrans %}
{% endautoescape %}
7 changes: 7 additions & 0 deletions templates/account/email/email_confirmation_message.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "account/email/base_message.txt" %}
{% load account %}
{% load i18n %}

{% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}You're receiving this e-mail because user {{ user_display }} has given your e-mail address to register an account on {{ site_domain }}.

To confirm this is correct, go to {{ activate_url }}{% endblocktrans %}{% endautoescape %}{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "account/email/email_confirmation_message.txt" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "account/email/email_confirmation_subject.txt" %}
4 changes: 4 additions & 0 deletions templates/account/email/email_confirmation_subject.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %}
{% endautoescape %}
9 changes: 9 additions & 0 deletions templates/account/email/password_reset_key_message.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "account/email/base_message.txt" %}
{% load i18n %}

{% block content %}{% autoescape off %}{% blocktrans %}You're receiving this e-mail because you or someone else has requested a password for your user account.
It can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %}

{{ password_reset_url }}{% if username %}

{% blocktrans %}In case you forgot, your username is {{ username }}.{% endblocktrans %}{% endif %}{% endautoescape %}{% endblock %}
4 changes: 4 additions & 0 deletions templates/account/email/password_reset_key_subject.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Reset E-mail{% endblocktrans %}
{% endautoescape %}
12 changes: 12 additions & 0 deletions templates/account/email/unknown_account_message.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "account/email/base_message.txt" %}
{% load i18n %}

{% block content %}{% autoescape off %}{% blocktrans %}You are receiving this e-mail because you or someone else has requested a
password for your user account. However, we do not have any record of a user
with email {{ email }} in our database.

This mail can be safely ignored if you did not request a password reset.

If it was you, you can sign up for an account using the link below.{% endblocktrans %}

{{ signup_url }}{% endautoescape %}{% endblock %}
4 changes: 4 additions & 0 deletions templates/account/email/unknown_account_subject.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Reset E-mail{% endblocktrans %}
{% endautoescape %}
31 changes: 31 additions & 0 deletions templates/account/email_confirm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{% extends "account/base.html" %}

{% load i18n %}
{% load account %}

{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %}


{% block content %}
<h1>{% trans "Confirm E-mail Address" %}</h1>

{% if confirmation %}

{% user_display confirmation.email_address.user as user_display %}

<p>{% blocktrans with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p>

<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
{% csrf_token %}
<button type="submit">{% trans 'Confirm' %}</button>
</form>

{% else %}

{% url 'account_email' as email_url %}

<p>{% blocktrans %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktrans %}</p>

{% endif %}

{% endblock %}
Loading