Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4e12371
page for verification, frontend see frontend/src/components/Login.vue…
Sep 4, 2025
3f0ef5a
fix:update with latest dev
A-lexisL Sep 5, 2025
84a8a04
fix: migrate endpoint and fix multireview error
A-lexisL Sep 6, 2025
b540272
fix: config files(webhook excluded)
A-lexisL Sep 6, 2025
c84f120
feat: oauth config and initiate
A-lexisL Sep 7, 2025
9073d25
feat: add verification code and verify_callback_api with sessionid, t…
A-lexisL Sep 8, 2025
f9cbe91
feat: update initiate config and verify api for new oauth workflow
A-lexisL Sep 10, 2025
7f88771
feat:set password api
A-lexisL Sep 10, 2025
da5f1bf
fix: rm ngrok url and some typos
A-lexisL Sep 10, 2025
cdf7673
refactor: mv helpers to utils.py and improve return
A-lexisL Sep 12, 2025
f2be4bd
refactor: mv config into development.yaml and fix some cq
A-lexisL Sep 12, 2025
7109539
refactor: apart signup and reset_password
A-lexisL Sep 17, 2025
d9a2e00
fix: uncomment turnstile check
A-lexisL Sep 17, 2025
6aa01da
feat: add frontend for authorization
4rthurCai Sep 17, 2025
569df7b
fix: rm reset action
A-lexisL Sep 17, 2025
be1d594
fix: fix failure in auth and refactor code for better cq
4rthurCai Sep 18, 2025
9a8308e
fix: fix redirect interval and turnstile
4rthurCai Sep 18, 2025
c76ec96
fix: fix user icon after login
4rthurCai Sep 18, 2025
ac870ff
fix: add turnstile for password login
A-lexisL Sep 19, 2025
8557611
refactor: frontend
4rthurCai Sep 22, 2025
3dceeb2
chore(Makefile): Update linting and formatting commands
PACHAKUTlQ Sep 23, 2025
b93bd60
chore(Makefile): Support installing frontend
PACHAKUTlQ Sep 23, 2025
0ef26b9
chore(Makefile): Only display changed files when formatting
PACHAKUTlQ Sep 23, 2025
7032506
chore(Makefile): Only show formatted files and silent if no changes
PACHAKUTlQ Sep 23, 2025
3e814ef
chore(Makefile)!: Revert success message displaying and ignore errors
PACHAKUTlQ Sep 23, 2025
941a96e
fix: fix error in comment without logging
4rthurCai Sep 23, 2025
e69b1b4
fix: password strength, otp digit-only
A-lexisL Sep 26, 2025
007152a
Merge pull request #11 from Tech-JI/fix/auth
PACHAKUTlQ Sep 26, 2025
0aa3f4c
chore: submodule
zzjc1234 Sep 25, 2025
d3a23a7
chore: load env in settings.py instead of using yaml
A-lexisL Sep 27, 2025
d8d7db3
Merge pull request #20 from Tech-JI/chore/submodule
PACHAKUTlQ Sep 28, 2025
1580976
chore!: Update .gitignore
PACHAKUTlQ Sep 28, 2025
12e4c33
Merge pull request #21 from Tech-JI/chore/git
PACHAKUTlQ Sep 28, 2025
cd4c2dd
chore: use json load for list config
A-lexisL Sep 28, 2025
9f8a03b
fix(settings)!: Remove legacy static file and celery settings
PACHAKUTlQ Sep 29, 2025
7c980f7
fix(routing)!: Remove legacy analytics and recommendations apps
PACHAKUTlQ Sep 29, 2025
b6148aa
fix(Makefile)!: Run server without processing static files
PACHAKUTlQ Sep 29, 2025
cda37c4
fix(chore)!: Remove legacy static files and celery dependencies
PACHAKUTlQ Sep 29, 2025
32c008a
fix(django)!: Remove legacy celery initialization
PACHAKUTlQ Sep 29, 2025
8c491a6
fix(Makefile): Remove nostatic flags
PACHAKUTlQ Sep 29, 2025
1fc0124
feat(config)!: Add config class to auto handle env and yaml config
PACHAKUTlQ Sep 29, 2025
27731c2
feat(config)!: Use new config supporting env, yaml and default
PACHAKUTlQ Sep 29, 2025
0f388c2
feat(config)!: Add example yaml config and .env file
PACHAKUTlQ Sep 29, 2025
0a58389
fix(auth)!: Use new config system format
PACHAKUTlQ Sep 29, 2025
e773643
fix(lib)!: Remove legacy offering threshold env variable to avoid bre…
PACHAKUTlQ Sep 29, 2025
79c0711
feat(config)!: Use deep merge to adapt to configs of all types for ev…
PACHAKUTlQ Sep 29, 2025
2db98b5
fix(settings)!: Use complete default config to avoid errors
PACHAKUTlQ Sep 29, 2025
25502d3
fix(settings)!: Uncomment template parts used by django admin
PACHAKUTlQ Sep 29, 2025
f20f611
fix(auth)!: Use new config system
PACHAKUTlQ Sep 29, 2025
7e867b3
fix(auth)!: Use unified helper function to get quest details
PACHAKUTlQ Sep 29, 2025
cb87a88
fix(config)!: Fix of failed migrations (DB not connected due to wrong…
PACHAKUTlQ Sep 29, 2025
d4907bc
fix(auth)!: Use new config system, change keys to upper cases
PACHAKUTlQ Sep 29, 2025
fce4292
refactor(config)!: Refactor config parsing, use upper case for keys
PACHAKUTlQ Sep 29, 2025
482eedc
fix(settings)!: Add missing TURNSTILE_SECRET_KEY to make default conf…
PACHAKUTlQ Sep 29, 2025
62970e6
fix(auth)!: Use lower-case url as this is from utils but not settings.py
PACHAKUTlQ Sep 29, 2025
1c2ef28
fix(config)!: Correctly implement deep merge
PACHAKUTlQ Sep 29, 2025
0d2264a
fix(settings)!: Remove unused FRONTEND_URL
PACHAKUTlQ Sep 29, 2025
a835147
feat(config)!: Add example .env and config.yaml files
PACHAKUTlQ Sep 29, 2025
4ccf115
feat(chore)!: Update .gitignore and ignore config.yaml
PACHAKUTlQ Sep 29, 2025
03436ab
fix(chore)!: Ignore config.yaml
PACHAKUTlQ Sep 29, 2025
25423c8
fix(settings)!: Remove default SECRET_KEY to fail if not setting it
PACHAKUTlQ Sep 29, 2025
4548233
docs(config): Add docs for config
PACHAKUTlQ Sep 29, 2025
484a2ed
fix(docs): Fix typo
PACHAKUTlQ Sep 29, 2025
4cf80ec
Merge branch 'dev' into config
PACHAKUTlQ Sep 29, 2025
722611f
Merge pull request #22 from Tech-JI/config
zzjc1234 Sep 30, 2025
ec9c554
docs: Add auth.md
PACHAKUTlQ Sep 28, 2025
85eb4df
docs: Use lower-case for docs file names
PACHAKUTlQ Sep 28, 2025
5293a92
style(docs): Format docs/
PACHAKUTlQ Sep 28, 2025
e8f9a92
refactor: rm unuse code of students and signup form
A-lexisL Oct 2, 2025
b70b1a1
fix: Fix utils type warning
PACHAKUTlQ Oct 4, 2025
af4a705
fix(auth): Handle potential error response of turnstile verification …
PACHAKUTlQ Oct 6, 2025
4b491fb
docs(auth): Minor additional notes about auth design
PACHAKUTlQ Oct 7, 2025
1ac6332
Merge pull request #26 from Tech-JI/auth
PACHAKUTlQ Oct 12, 2025
803567d
fix(auth)!: Fix log injection vulnerabilities reported by codeql
PACHAKUTlQ Oct 13, 2025
75d5541
Merge pull request #28 from Tech-JI/auth
PACHAKUTlQ Oct 13, 2025
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
42 changes: 42 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# .env.example
# Copy this file to .env and fill in the secrets for local development.
# DO NOT COMMIT .env TO VERSION CONTROL.
# This file overrides config.yaml

# --- Core Security (REQUIRED IN PRODUCTION) ---
# Generate a new one for production!
SECRET_KEY=django-insecure-my-local-dev-secret-key

# --- Local Overrides ---
# Set to False in production
# DEBUG=True

# --- Infrastructure (REQUIRED) ---
# Use a single URL for database and Redis connections.
# Format: driver://user:password@host:port/dbname
DATABASE__URL=postgres://admin:test@127.0.0.1:5432/coursereview
REDIS__URL=redis://localhost:6379/0

# --- External Services Secrets (REQUIRED) ---
TURNSTILE_SECRET_KEY=dummy0

# Use PARENT__CHILD format to override nested settings
# URL and ID may be specified in config.yaml
QUEST__SIGNUP__API_KEY=dummy1
# QUEST__SIGNUP__URL=
# QUEST__SIGNUP__QUESTIONID=

QUEST__LOGIN__API_KEY=dummy2
# QUEST__LOGIN__URL=
# QUEST__LOGIN__QUESTIONID=

QUEST__RESET__API_KEY=dummy3
# QUEST__RESET__URL=
# QUEST__RESET__QUESTIONID=

# --- Other Overrides (Optional) ---
# Example of overriding a nested value in the AUTH dictionary
# AUTH__OTP_TIMEOUT=60

# Example of overriding a list with a comma-separated string
# ALLOWED_HOSTS=localhost,127.0.0.1,dev.my-app.com
188 changes: 160 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
### Project ignores
.venv/
venv/
staticfiles
.env
.pyversion
data
config.yaml

### Python ignores (https://github.com/github/gitignore/blob/master/Python.gitignore)
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*.py[codz]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
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.
# 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

Expand All @@ -45,44 +41,180 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

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

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

package-lock.json
pnpm-lock.yaml
bun.lock
# Jupyter Notebook
.ipynb_checkpoints

node_modules
**/node_modules
# 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

.DS_Store
**/.DS_Store
# 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

# node version compabilities
.nvmrc
course-activity-service-account.json
Layup-List.code-workspace
.vscode/
db.sqlite3
*.db
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# uv.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
# poetry.toml

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
# pdm.lock
# pdm.toml
.pdm-python
.pdm-build/

# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
# pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi

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

# Celery stuff
celerybeat-schedule
celerybeat.pid

# Redis
*.rdb
.aider*
*.aof
*.pid

# RabbitMQ
mnesia/
rabbitmq/
rabbitmq-data/

# ActiveMQ
activemq-data/

# SageMath parsed files
*.sage.py

# Environments
.env
.envrc
.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 maintained 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/

# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/

# Streamlit
.streamlit/secrets.toml

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "frontend"]
path = frontend
url = https://github.com/Tech-JI/CourseFront
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: run clean collect format format-backend format-frontend makemigrations migrate shell createsuperuser dev-frontend help
.PHONY: run dev-frontend clean collect install-frontend format format-backend format-frontend lint lint-backend lint-frontend makemigrations migrate shell createsuperuser help

# Default target when 'make' is run without arguments
.DEFAULT_GOAL := help
Expand All @@ -9,9 +9,13 @@ help:
@echo " dev-frontend - Starts the frontend development server (formats frontend code first)"
@echo " clean - Clears Django session data"
@echo " collect - Collects Django static files"
@echo " install-frontend - Installs frontend dependencies using bun"
@echo " format - Formats both backend (Python) and frontend (JS/TS/CSS) code"
@echo " format-backend - Formats Python code using isort and black"
@echo " format-frontend - Formats frontend code using prettier"
@echo " lint - Lints both backend (Python) and frontend (JS/TS/CSS) code"
@echo " lint-backend - Lints Python code using ruff"
@echo " lint-frontend - Lints frontend code using eslint"
@echo " makemigrations - Creates new Django model migrations"
@echo " migrate - Applies Django database migrations"
@echo " shell - Opens a Django shell"
Expand All @@ -33,6 +37,10 @@ collect:
@echo "Collecting Django static files (confirming 'yes')..."
echo 'yes' | uv run manage.py collectstatic

install-frontend:
@echo "Installing frontend dependencies with bun..."
cd frontend && bun install

format: format-backend format-frontend
@echo "All code formatted successfully!"

Expand All @@ -42,7 +50,18 @@ format-backend:

format-frontend:
@echo "Formatting frontend code with prettier..."
cd frontend && bunx prettier . -w
cd frontend && bun run format | grep -v -F '(unchanged)' || true

lint: lint-backend lint-frontend
@echo "All code linted successfully!"

lint-backend: format-backend
@echo "Linting backend (Python) code with ruff..."
uvx ruff check

lint-frontend: format-frontend
@echo "Linting frontend code with eslint..."
cd frontend && bun run lint

makemigrations:
@echo "Creating Django database migrations..."
Expand Down
1 change: 1 addition & 0 deletions apps/auth/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = "apps.auth.apps.OAuthConfig"
3 changes: 3 additions & 0 deletions apps/auth/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
7 changes: 7 additions & 0 deletions apps/auth/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.apps import AppConfig


class OAuthConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "apps.auth"
label = "oauth" # Unique label to avoid conflict with django.contrib.auth
Empty file.
3 changes: 3 additions & 0 deletions apps/auth/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
3 changes: 3 additions & 0 deletions apps/auth/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
Loading