Skip to content

JohnDivi/RegisterAndLogin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RegisterAndLogin

Project Description

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.

To do tests

  • Call "make tests" in terminal

Planning

Note: finished plans will have a strikethrough like this followed by DONE

Creating the Database class

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

addUser(username, password) DONE

  • Adds a user to the map

checkCorrectDetails(username, password) DONE

  • Check if username and password matches the one in the map

updateDBFile(path) DONE

  • Updates the database file in the specified path

getUsernames() DONE

  • 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

Creating the User class

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

registerUser(&database, stream) DONE

  • ~~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

loginUser(database, stream) DONE

  • 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

pickEntriesAction(action, stream) DONE

  • Ask user for action from stream: view, edit, add, delete, and save entries.

The constructor sets the entries path of users DONE

Creating the Menu class

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

getMenuChoice(menu) DONE

  • Show menu passed in argument
  • Gets number input from user and return

addMenu(menuName, menuContent) DONE

  • Add menuName as key in unordered_map and menuContent as the value

The constructor only creates a Menu object. DONE

Running main()

  • Load the database
  • Setup menus
  • Main loop

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors