You are required to implement database functionality for your registration page that was previously implemented in Assignment 1 and 2 . Thus, when a user fills out the registration form and then hits the submit button, provided that all the validation criteria were not violated, your website must then create a user account in your database.
Once the user account is created, your web application must then redirect the user to a dashboard page.
Regarding your database functionality, the following rules must be followed :
1. Setup and configure a MongoDB cloud service using MongDB Atlas https://www.mongodb.com/cloud/atlas.
2. Connect your web application to your mongoDB database using an ODM called Mongoose.
3. Name your database and collections appropriately.
4. Ensure that the email field in your registration form is unique, thus your application must prohibit different users from having the same email in the database.
5. Passwords must not be stored in plain text in the database, thus your application must store passwords in an encrypted format. You can use a 3rd party package called bcryptjs to do the aforementioned.
You are required to implement a fully functional authentication module with the following features:
â—� Your application must allow an Data Entry Clerk and customers who want to purchase meal packages, to log-in via the login form created in Assignment 1 and 2.
â—� Upon a successful authentication(entering an email and password pair that exists in the database) a session must be created to maintain the user state until they have logged out of the application.
â—� To implement sessions in an Express app you can use https://github.com/expressjs/session
â—� Upon an unsuccessful authentication, the application must display an appropriate message (Example: Sorry, you entered the wrong email and/or password)
â—� Also after successfully authenticating,the application must determine if the person logging in is a data entry clerk or a regular user and will be redirected to their respective dashboard.
â—� A customer will be directed to a user dashboard and a data entry clerk will be directed to a data entry clerk dashboard.
â—� Both dashboards, must show the user’s name(first name and lastname) and a logout link
â—� The logout link must destroy the session created when the user initially authenticated.
â—� Specific routes can only be accessed when users are logged-in, thus those routes must be protected.
You are required to implement a Data Entry Clerk module that allow an data entry clerk to do the following :
1. Create Meal Packages: The Data Entry Clerk must be able to add new meal packages to the database. See the following data that must be added when a product is created:
a. Meal Package name,
b. Meal Package price,
c. Meal Package description or details,
d. Meal Package food category
e. The number of meals inside the package
f. Set Meal package as a top package to be shown on the home page(or not).
g. Upload a photo of the meal package(to keep the project simple, only upload one image per meal package).
2. Ensure that all created meal packages that were entered into the database are populated on the front-end of the web application, specifically on the meal package listing page that was created in Assignment 1 and 2. Additionally, only meal packages that were set as “Top Meal Packages” should be populated in the “Top Meal Package” section of the home page. Please note, a visitor to the web application does not need to be logged in to view the meal packages that were created by the data entry clerk.
3. Ensure that a user can only upload an image, i.e jpgs,gifs,pngs, for the meal package photo.
4. View a list of all created meal packages.
5. Edit and change meal package details for a selected meal package. Example : price, title etc