This web application, built on Flask framework, is designed to allow users to create customized study cards. With the ability to create collections and associated study cards, the user can conveniently test their knowledge by accessing the cards without the content at first.
In addition to the core functionality, there is a secure registration and authentication system, and a password-changing option.
The authentication mechanism has been implemented with rate-limiting, salted passwords, and testing to ensure robust security.
The application is backed by a relational database that utilizes SQLite.
On the client side, AJAX has been implemented using the jQuery JavaScript library.
Clone the repository:
git clone https://github.com/hanit-com/cs50-project.git
Install the required packages:
pip install -r requirements.txt
python3 app.py
flask run
pytest
Interact with the local DB:
sqlite3 project.db
All parameters are required
GET /login
Returns rendered template of "login.html".
POST /login
Parameter | Type |
---|---|
username |
string |
password |
string |
Saves user ID in sesison and redirects to initial page.
GET /register
Returns rendered template of "register.html".
POST /register
Parameter | Type | Description |
---|---|---|
username |
string |
|
password |
string |
|
confirmation |
string |
User input for new password confirmation |
Redirects to initial page.
GET /
Returns rendered template of "index.html" if logged in or "login.html" if not.
GET /collections
JSON response. Internaly usses the session for user ID, no parameters needed.
POST /createCollection
Parameter | Type | Description |
---|---|---|
name |
string |
Name for the new collection. |
JSON response.
DELETE /deleteCollection
Parameter | Type | Description |
---|---|---|
id |
string |
Collection ID. |
JSON response.
GET /collection
Parameter | Type | Description |
---|---|---|
id |
string |
Collection ID. |
Returns rendered template of "collection.html".
GET /cards
Parameter | Type | Description |
---|---|---|
id |
string |
Collection ID. |
JSON response.
DELETE /deleteCard
Parameter | Type | Description |
---|---|---|
id |
string |
Card ID. |
JSON response.
POST /createCard
Parameter | Type | Description |
---|---|---|
title |
string |
|
content |
string |
|
collection_id |
string |
The collection the card is related to. |
JSON response.
GET /changePassword
Returns rendered template of "change_password.html".
POST /changePassword
Parameter | Type | Description |
---|---|---|
current_password |
string |
|
new_password |
string |
|
confirmation |
string |
Redirects to initial page.
POST /logout
Clears the session and redirects to intial page.