11#Login Page
22
33##Environment Requirements
4+ ###General
5+ - Windows 10
6+
7+ ###Backend
8+ - Python 3.12.4
9+
10+ ###Frontend
411- Node.js v20.11.1
512- npm v10.5.0
6- - Windows 10
713
814##Installation Instructions
915
10161 . ** Clone the repository**
1117``` bash
12- git clone https://github.com/helloworld0606/interviewProjects .git
18+ git clone https://github.com/helloworld0606/interviewPython .git
1319 ```
1420
15- 2.** Run the backend server**
21+ 2.** Set up the backend server** (cmd)
1622` ` ` bash
17- cd interviewProjects/backend
18- npm install
19- npm audit# find security vulnerabilities
20- npm audit fix # fix any security vulnerabilities
21- node server.js
23+ cd C:\i nterviewPython\b ackend
24+ python -m venv venv
25+ .\v env\S cripts\a ctivate
26+ pip install -r requirements.txt
2227` ` `
2328
24- 3. ** Run the frontend server ** (open another cmd)
29+ ** Install Rust ** (if not already installed) Rust is needed to compile ` bcrypt `
2530` ` ` bash
26- cd interviewProjects/frontend
31+ curl --proto' =https' --tlsv1.2 -sSf https://sh.rustup.rs| sh
32+ ` ` `
33+
34+ ** Run the backend server**
35+ ` ` ` bash
36+ python app.py
37+ ` ` `
38+
39+ 4.** Run the frontend server** (terminal)
40+ ` ` ` bash
41+ cd C:\i nterviewPython\f rontend
2742 npm install
2843 npm audit# find security vulnerabilities
2944 npm audit fix # fix any security vulnerabilities
3045 npm run serve
3146` ` `
3247
33- 4 .** The app will run at [http://localhost:8080/](http://localhost:8080/)**
48+ 5 .** The app will run at [http://localhost:8080/](http://localhost:8080/)**
3449
3550
3651
3752# # Account info in db.json
38- ( make sure backend is running)
53+ " make sure backend is running"
3954
4055Get account
4156` ` ` bash
@@ -47,7 +62,15 @@ curl -X POST "http://localhost:3000/users" -H "Content-Type: application/json" -
4762```
4863Login account
4964```
50- curl -X POST "http://localhost:3000/users/login " -H "Content-Type: application/json" -d "{\" account\" :\" james123@gmail.com \" ,\" password\" :\" DEF789\" }"
65+ curl -X POST "http://localhost:3000/users/login " -H "Content-Type: application/json" -d "{\" account\" :\" alice123@gmail.com \" ,\" password\" :\" ABC123456\" }"
66+ ```
67+ Two Factor Auth
68+ 1. When login is successful, a QR code window will pop up.
69+ 2. Scan the QR code using the Authenticator app on your iPhone.
70+ 3. Replace XXXXXX (6 digits) with the one-time code from MyApp.
71+
72+ ```
73+ curl -X POST "http://localhost:3000/2fa/verify-otp " -H "Content-Type: application/json" -d "{\" userId\" :1,\" otp\”:\”XXXXXX\”}”
5174```
5275
5376## Test account: