Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ea5bb5c
Create User, UserCredential models
bitRondo Mar 23, 2020
f23744b
index, login html files created and admin, urls, views files are changed
bitRondo Mar 23, 2020
8d8e6d6
Changed the Project structure
bitRondo Mar 28, 2020
a71af9a
Created a Custom User model and Implemented Login
bitRondo Mar 29, 2020
4336b5c
Login and Logout complete
bitRondo Mar 30, 2020
27c4058
User account creation w/o email verification Done
bitRondo Mar 30, 2020
3958470
Account Creation + Email Verification completed!
bitRondo Mar 31, 2020
fd5e523
Don't let anonymous users access activate page
bitRondo Mar 31, 2020
16b452c
Viewing Records within a Range of dates - Done
bitRondo Apr 4, 2020
d91f8cd
Concurrent threads implemented + Scheduled tasks
bitRondo Apr 5, 2020
615be8a
installed the mainApp
NuwanthikaW96 Apr 6, 2020
c9e29e9
created an admin user
NuwanthikaW96 Apr 6, 2020
3fbd580
create a form for add recipient for security alert
NuwanthikaW96 Apr 6, 2020
0dddf8a
View Statistics on a given date - DONE
bitRondo Apr 7, 2020
55d648b
Modified requirements.txt
bitRondo Apr 7, 2020
aa4e174
Statistics - Disabled dates in template + Bug fix
bitRondo Apr 7, 2020
05b310e
Password change - DONE
bitRondo Apr 8, 2020
9de4346
Added 'receive reports' field to User model
bitRondo Apr 10, 2020
bff81b8
Change Operational Mode - DONE
bitRondo Apr 10, 2020
d281300
Auto-Switching halfway done
bitRondo Apr 10, 2020
69f3d23
Do changes
NuwanthikaW96 Apr 11, 2020
624b0e3
Delete main app
NuwanthikaW96 Apr 11, 2020
7e09f3c
changes
NuwanthikaW96 Apr 11, 2020
0f8a5f2
installsecurityAlerts app
NuwanthikaW96 Apr 11, 2020
093a3ce
installed the mainApp
NuwanthikaW96 Apr 6, 2020
f99ad46
created an admin user
NuwanthikaW96 Apr 6, 2020
c636a8c
create a form for add recipient for security alert
NuwanthikaW96 Apr 6, 2020
728dcdc
Do changes
NuwanthikaW96 Apr 11, 2020
2062c85
Delete main app
NuwanthikaW96 Apr 11, 2020
0af3cf4
changes
NuwanthikaW96 Apr 11, 2020
65e7a8e
installsecurityAlerts app
NuwanthikaW96 Apr 11, 2020
16c2f17
Merge branch 'NuwanthikaDevNew' of https://github.com/bitRondo/human-…
NuwanthikaW96 Apr 11, 2020
5631776
Autoswitching DONE - w/o form validation
bitRondo Apr 11, 2020
db64281
Security recipient add halfly done
NuwanthikaW96 Apr 11, 2020
0e9c09c
Merge branch 'DisuraDev' of https://github.com/bitRondo/human-trackin…
NuwanthikaW96 Apr 11, 2020
be0560d
send email to security recipient halfly done.
NuwanthikaW96 Apr 15, 2020
70a9f5e
get prediction halfly done
NuwanthikaW96 Apr 17, 2020
895ba3d
Add security recipient Done
NuwanthikaW96 Apr 18, 2020
4ad9c34
Delete security recipient done
NuwanthikaW96 Apr 18, 2020
a1db8da
Do changes in delete recipient
NuwanthikaW96 Apr 18, 2020
601cc4a
graphs-halfly done
NuwanthikaW96 Apr 21, 2020
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
40 changes: 40 additions & 0 deletions HumanTrackingSystem/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',


'securityManagement.apps.SecuritymanagementConfig',
#'accountManagement.apps.AccountmanagementConfig',
'statisticsManagement.apps.StatisticsmanagementConfig',
#'systemManagement.apps.SystemmanagementConfig'
'predictionManagement.apps.PredictionmanagementConfig',
'graphManagement.apps.GraphmanagementConfig',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -118,3 +126,35 @@
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'

LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/login/'

#AUTH_USER_MODEL = 'accountManagement.User'

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

ADMINS = (
('DisuraTest', 'disura.test@gmail.com'),
)

MANAGERS = ADMINS


# When you are playing around with the app and you expect that an email should
# have been sent, just run `./manage.py send_mail` and you will get the mail
# to the ADMINS account, no matter who the real recipient was.
TEST_EMAIL_BACKEND_RECIPIENTS = ADMINS

FROM_EMAIL = ADMINS[0][1]
EMAIL_SUBJECT_PREFIX = '[dev human-tracking-surveillance] '
#EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
EMAIL_BACKEND ='django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'surveillancesystemcse@gmail.com'

# Enter your gmail PW from the ADMINS email entered above.
EMAIL_HOST_PASSWORD = 'System-123'
EMAIL_PORT = 587

EMAIL_USE_TLS = True
11 changes: 9 additions & 2 deletions HumanTrackingSystem/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import include, path

urlpatterns = [
path('securityManagement/', include('securityManagement.urls')),
path('admin/', admin.site.urls),
]
#path('', include('accountManagement.urls')),
path('statistics/', include('statisticsManagement.urls')),
path('system/', include('systemManagement.urls')),
path('prediction/', include('predictionManagement.urls')),

path('graph/', include('graphManagement.urls')),
]
5 changes: 5 additions & 0 deletions HumanTrackingSystem/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

from django.core.wsgi import get_wsgi_application

#from videoAnalysis.videoAnalysis import runMain

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'HumanTrackingSystem.settings')

application = get_wsgi_application()

# Uncomment the following line to load background processes which are in videoAnalysis module
# runMain()
File renamed without changes.
27 changes: 27 additions & 0 deletions accountManagement/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from django.contrib import admin

from django.contrib.auth.admin import UserAdmin

from .forms import CustomizedUserCreationForm, CustomizedUserChangeForm
from .models import User

class CustomizedUserAdmin (UserAdmin):
add_form = CustomizedUserCreationForm
form = CustomizedUserChangeForm
model = User
list_display = ('first_name', 'username', 'email', 'is_staff', 'is_active',)
list_filter = ('first_name', 'username', 'email', 'is_staff', 'is_active',)
fieldsets = (
(None, {'fields': ('email', 'password')}),
('Permissions', {'fields': ('is_staff', 'is_active')}),
)
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('first_name', 'username', 'email', 'password1', 'password2', 'is_staff', 'is_active')}
),
)
search_fields = ('username', 'email',)
ordering = ('username', 'email',)

admin.site.register(User, CustomizedUserAdmin)
5 changes: 5 additions & 0 deletions accountManagement/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AccountmanagementConfig(AppConfig):
name = 'accountManagement'
56 changes: 56 additions & 0 deletions accountManagement/controllers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from .models import User
from django.utils import timezone
from datetime import timedelta

import random

def create_activation_key():
user_exists = True
while (user_exists):
key = random.randint(100000, 999999)
user_exists = User.objects.filter(activation_key = key).exists()

return str(key)

def send_activation_key(user, resend = False):
key = create_activation_key()
keyString = key[:3] + '-' + key[3:]
subject = "Account Activation"

if not resend:
message = ("<h1>Thank you for registering at HumanTrackingSurveillance!</h1>" +
"<p>Please use the following activation code to activate your account:</p>" +
"<h2>%s</h2>"%keyString +
"<p>We hope you enjoy using HumanTrackingSurveillance!</p>" +
"<small>Please note that the above activation code will be valid only within 24 hours after being sent.</small>")
else:
message = ("<h1>New Activation Code</h1>" +
"<p>Your new activation code is:</p>" +
"<h2>%s</h2>"%keyString +
"<p>We hope you enjoy using HumanTrackingSurveillance!</p>" +
"<small>Please note that the above activation code will be valid only within 24 hours after being sent.</small>")

from_email = "HTS@hts.com"


user.activation_key = key
user.key_expiry = timezone.now() + timedelta(hours = 24)
user.save()

print (keyString)
# send_mail(subject, "", from_email, ["disurawaru.17@cse.mrt.ac.lk",], html_message = message)

user.email_user(subject, "", from_email = from_email, html_message = message)



# from accountManagement.controllers import a
def test_mail():
subject = "Account Activation"
message = "Please use this email to activate your account"
from_email = "HTS@hts.com"
to_email = ["disurawaru.17@cse.mrt.ac.lk",]
send_mail(subject, message, from_email, to_email)

from django.core.mail import send_mail
send_mail("Helo", "Test mail", "HTS@hts.com", ["disurawaru.17@cse.mrt.ac.lk",])
17 changes: 17 additions & 0 deletions accountManagement/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.contrib.auth.forms import UserCreationForm, UserChangeForm

from .models import User

class CustomizedUserCreationForm (UserCreationForm):

class Meta (UserCreationForm):
model = User
fields = ('first_name', 'last_name', 'email', 'phone',
'username', 'password1', 'password2','receive_reports')

class CustomizedUserChangeForm (UserChangeForm):

class Meta (UserChangeForm):
model = User
fields = ('first_name', 'email')

34 changes: 34 additions & 0 deletions accountManagement/managers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from django.contrib.auth.base_user import BaseUserManager

from django.utils.translation import ugettext_lazy as _

class UserManager (BaseUserManager):
def create_user (self, first_name, username, email, password, **extra_fields):
if not first_name:
raise ValueError(_('The first name is required'))
elif not username:
raise ValueError(_('Username is required'))
elif not email:
raise ValueError(_('The email is required'))

email = self.normalize_email(email)

user = self.model(first_name = first_name, username = username, email = email, **extra_fields)
user.set_password(password)

user.save()

return user

def create_superuser (self, first_name, username, email, password, **extra_fields):

extra_fields.setdefault('is_superuser', True)
extra_fields.setdefault('is_staff', True)

if extra_fields.get('is_superuser') is not True:
raise ValueError(_('Super user must have is_superuser = True'))

if extra_fields.get('is_staff') is not True:
raise ValueError(_('Super user must have is_staff = True'))

return self.create_user(first_name, username, email, password, **extra_fields)
38 changes: 38 additions & 0 deletions accountManagement/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 2.2.11 on 2020-03-29 18:53

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0011_update_proxy_permissions'),
]

operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('first_name', models.CharField(help_text='Required', max_length=20, verbose_name='first name')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, verbose_name='username')),
('email', models.EmailField(error_messages={'unique': 'That email is already being used by another user.'}, help_text='Required', max_length=150, unique=True, verbose_name='email')),
('last_name', models.CharField(blank=True, max_length=50)),
('phone', models.CharField(blank=True, max_length=10)),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('is_admin', models.BooleanField(default=False, help_text='Designates whether this user has admin privileges', verbose_name='admin status')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'abstract': False,
},
),
]
18 changes: 18 additions & 0 deletions accountManagement/migrations/0002_user_is_staff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.11 on 2020-03-29 19:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('accountManagement', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='user',
name='is_staff',
field=models.BooleanField(default=False, help_text='Designates whether this user has access to admin site', verbose_name='staff status'),
),
]
31 changes: 31 additions & 0 deletions accountManagement/migrations/0003_auto_20200331_1501.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 2.2.11 on 2020-03-31 09:31

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('accountManagement', '0002_user_is_staff'),
]

operations = [
migrations.RemoveField(
model_name='user',
name='date_joined',
),
migrations.RemoveField(
model_name='user',
name='is_admin',
),
migrations.AddField(
model_name='user',
name='activation_key',
field=models.CharField(blank=True, help_text='This saves the activation key sent at the creation of the account.When logged in, if this is True, the user is asked to activate the account.', max_length=10, verbose_name='activation key'),
),
migrations.AddField(
model_name='user',
name='key_expiry',
field=models.DateTimeField(default=None, null=True, verbose_name='key expiry'),
),
]
18 changes: 18 additions & 0 deletions accountManagement/migrations/0004_user_receive_reports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.11 on 2020-04-10 09:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('accountManagement', '0003_auto_20200331_1501'),
]

operations = [
migrations.AddField(
model_name='user',
name='receive_reports',
field=models.BooleanField(default=True, verbose_name='reception of monthly reports'),
),
]
Loading