Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9757cc2
Initializing database and loading data.
darinnickloy Feb 22, 2022
6252e1e
Dockerizing backend
darinnickloy Feb 23, 2022
32ec7db
Front end started, retrieving data from API
darinnickloy Feb 24, 2022
b2fdde3
Adding Astro login form (unscripted)
darinnickloy Feb 24, 2022
ffcaef6
Adding GlobalStatusBar header.
darinnickloy Feb 24, 2022
ea0e038
UI now rendering all data from API calls.
darinnickloy Feb 24, 2022
e18f6f1
Now loading alerts and contacts tables.
darinnickloy Feb 25, 2022
89dad8f
All data needing displayed on dashboard is present
darinnickloy Feb 25, 2022
67cdf62
Starting work on user registeration
darinnickloy Feb 26, 2022
bb6f18d
User registration ready for testing.
darinnickloy Feb 27, 2022
98e4a03
Register and login working, needs cleaning
darinnickloy Feb 27, 2022
4647b71
Added authentication to pages
darinnickloy Feb 27, 2022
98ae72b
Adding redirects to login and register.
darinnickloy Feb 27, 2022
e031596
Login finally working right.
darinnickloy Feb 27, 2022
ff66bf0
Lets try this login fix one more time.
darinnickloy Feb 27, 2022
f6354b8
Working on UI layout/tweaks.
darinnickloy Feb 27, 2022
b27fb7b
Fixing another bug in the login page.
darinnickloy Feb 27, 2022
4d61ad4
Refactoring header into a vue.
darinnickloy Feb 27, 2022
c837a78
Cleaning up top header.
darinnickloy Feb 27, 2022
29cb0e4
Refactoring the user registration code.
darinnickloy Feb 27, 2022
8e9a685
Refactoring time formatting code to shared js.
darinnickloy Feb 27, 2022
c152b53
CSS Changes to top header.
darinnickloy Feb 27, 2022
0c545b7
Centering up content on the page.
darinnickloy Feb 27, 2022
f7ff6db
Code cleanup.
darinnickloy Feb 27, 2022
1320411
Starting table sorting.
darinnickloy Feb 28, 2022
566bd29
Stylizing the login screen
darinnickloy Feb 28, 2022
4c9c3af
Styling the registration form.
darinnickloy Feb 28, 2022
8c09566
Changing the alerts to use RUX tables.
darinnickloy Feb 28, 2022
ecad047
Updating the contacts table to use RUX
darinnickloy Feb 28, 2022
95f8ef5
Adding input validation on login and register forms
darinnickloy Feb 28, 2022
bf4b8fb
Working on dockerizing and bootsrapping
darinnickloy Feb 28, 2022
c0c638c
Dockerizing and updating time value converter.
darinnickloy Feb 28, 2022
bd88eb2
Removing old code.
darinnickloy Feb 28, 2022
f109adc
Commenting code.
darinnickloy Feb 28, 2022
bd7cc42
Addingn sorting to tables.
darinnickloy Feb 28, 2022
1cd04b3
Adding database diagram docuemnt.
darinnickloy Feb 28, 2022
72dd23e
Removing unused code.
darinnickloy Feb 28, 2022
c881e98
Removing depreicated code.
darinnickloy Feb 28, 2022
28fe01b
Removing depreicated code.
darinnickloy Feb 28, 2022
feaacf6
Changing favicon
darinnickloy Feb 28, 2022
d0e098b
Adding enterkey submit for login and register forms.
darinnickloy Feb 28, 2022
e411119
Adding heroku build file.
darinnickloy Feb 28, 2022
752db6b
Changing ports
darinnickloy Feb 28, 2022
52ed26d
Updating vue for dev server.
darinnickloy Feb 28, 2022
b240513
Testing secure get/post calls
darinnickloy Feb 28, 2022
86d40bb
Dev testing
darinnickloy Feb 28, 2022
0266e75
Converting frontend hosting to nginx.
darinnickloy Feb 28, 2022
d2a6793
Updating api url for deployment.
darinnickloy Feb 28, 2022
611e10d
Removing unused code.
darinnickloy Feb 28, 2022
5877f77
Updating api url for deploying.
darinnickloy Feb 28, 2022
782d14f
Updating the api signatures for deployement.
darinnickloy Feb 28, 2022
60c07a2
Fixing typo
darinnickloy Feb 28, 2022
370757d
Added step field to contact table to match the GRM
darinnickloy Feb 28, 2022
98b827d
Merge branch 'RocketCommunicationsInc:main' into main
darinnickloy Feb 28, 2022
4326fae
Update CODEOWNERS
darinnickloy Feb 28, 2022
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
186 changes: 186 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@

# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# End of https://www.toptal.com/developers/gitignore/api/python

## Custom blacklist
*.db

.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
@cskerbo
rocket-bensonism
darinnickloy
Binary file added docs/database-diagram.pdf
Binary file not shown.
4 changes: 4 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build:
docker:
api: project/backend/api
web: projectd/frontend
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"core-js": "^3.8.3",
"vue": "^3.2.13",
"vue-router": "^4.0.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-service": "~5.0.0"
}
}
20 changes: 20 additions & 0 deletions project/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Inherit container from Python
FROM python:3.8

# Set the containers working directory.
WORKDIR /code

# Update the PYTHONPATH variable to include the new working directory.
ENV PYTHONPATH "${PYTHONPATH}:/code"

# Copy the requirementst.txt file into the container.
COPY ./requirements.txt /code/requirements.txt

# Update the python packages with the requirements.txt file.
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Copy the code into the container.
COPY ./api /code

# Start the web server listening on port 80.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8887"]
Empty file added project/backend/api/__init__.py
Empty file.
73 changes: 73 additions & 0 deletions project/backend/api/auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import random
import string
import jwt
import datetime
from datetime import timezone
from passlib.context import CryptContext

pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")

# TODO: Move secret to shared Config for production.
SECRET = '996D0B3EF9B296A03B1C16B5E9E3CE787CE9C29A19194DDF7B7FF26F49080410'
ALGORITHM = 'HS256'

def create_salt(count):
"""
Create a password salt of a specified length.

:param count: The character length of the salt string.
:return: Returns the new salt string.
"""
ran = ''.join(random.choices(string.ascii_letters + string.digits, k = count))
return str(ran)


def get_password_hash(password):
"""
Hash a clear text password.

:param password: The clear text password to be hashed.
:return: Returns the hashed copy of the provided password.
"""
return pwd_context.hash(password)


def verify_password(plain_password, hashed_password):
"""
Verify that a clear password matched a hashed password.

:param plain_password: the plain text password to be compared.
:param hashed_password: the hashed verison of the password to be compared.
:return: returns true if the password matches the hashed verison, else false.
"""
return pwd_context.verify(plain_password, hashed_password)

def create_token(data, expires=30):
"""
Creates a JWT token with the embeded data, and expiration.

:param data: the data to be encoded into the token.
:param expires: the number of minutes the token is valid.
:return: returns the created token.
"""
payload = {
"exp": datetime.datetime.now(tz=timezone.utc) + datetime.timedelta(minutes=expires),
"data": data
}
token = jwt.encode(payload, SECRET, algorithm=ALGORITHM)
return token

def verify_token(token):
"""
Verify that the provided token is valid and has not expired.

:param token: the token to be decoded.
:return: returns true if the token is still valid, else false.
"""
try:
payload = jwt.decode(token, SECRET, algorithm=ALGORITHM)
return True, payload
except jwt.ExpiredSignatureError:
return False, None
except Exception:
return False, None
Loading