This project uses: classes, a database, and hashing to save and use user information for registering and logging in. Logging in allows the user to create "entries" which is similar to a journal. You may add, edit, and delete entries.
Currently, the program will be run on a CLI. I am looking forward to implementing this with a GUI in the future.
- Call "make tests" in terminal
Note: finished plans will have a strikethrough like this followed by DONE
The Database class will contain a single private variable containing all the user information.
Private variables:
- 'users' -> a map of usernames to hashed passwords
The Database class will contain these general functions:
- addUser(username, password) -> returns void (adds a user to the map)
- checkCorrectDetails(username, password) -> returns bool
- updateDBFile(path) -> returns void (updates the file containing usernames and passwords)
- getUsernames() -> returns a vector of strings containing usernames
- Adds a user to the map
- Check if username and password matches the one in the map
- Updates the database file in the specified path
- Goes through the map's usernames
- Returns a vector of usernames
The constructor will load the database taking in the path for user info. DONE
The User class will contain 3 private variables.
Private variables:
- 'username' -> contains the user's username
- 'entriesPath' -> contains the entries path
- 'entries' -> a vector containing the user's entries
The User class will contain these general functions:
- registerUser(&database, stream) -> returns true if done or false if fail
- loginUser(database, stream) -> returns true if done or false if fail
- pickEntriesAction(action, stream) -> returns void
- ~~Ask user for a username from stream and ensure that the chosen username does not exist. Hint: Check a vector of existing usernames
- Ask user for a password from stream and ensure that the password is valid (password will require at least 1 capital letter and 1 symbol)
- Hash the password using SHA256 or others
- Create an entries file for the user
- Store the username and hashed password into the database
- Update the database
- Notify user that the registration was successful and then return to the menu
- Ask user for a username and password from stream
- Verify that the username exists and matches the hashed password (checks database)
- Notify user that the login was successful
- Load entries of user
- Show logged in menu
- Ask user for action from stream:
view,edit,add,delete, andsaveentries.
The constructor sets the entries path of users DONE
The Menu class contains all menus.
Private variables:
- 'menus' -> unordered map containing type of menu as a key and its contents as values
The Menu class will contain these general functions:
- getMenuChoice(menu) -> returns user choice (int)
- addMenu(menuName, menuContent) -> void, adds a menu with the passed in parameters
- Show menu passed in argument
- Gets number input from user and return
- Add menuName as key in unordered_map and menuContent as the value
The constructor only creates a Menu object. DONE
- Load the database
- Setup menus
- Main loop