Admin Portal - rojatkaraditi/SMSHealthCare GitHub Wiki
This is the Admin Portal Website. Only admins can login to this website. And the admins are able to see users who have been subscribed.
-
Login
Design
As shown in the above screenshot, this is the login page for the admin portal.
The admin needs to enter the username and password to enter the portal. Only admins can enter this portal. If a username or password is wrong it will not let the user enter the potal.
Implementation
The login page has username and the password. The admin has to enter the username and password in order to enter the portal. Once a valid username and password is entered, a token is generated for the admin and is stored in the cookie.
Data Design
- When the site is loaded the browser checks for the cookie. If the cookie is present in the browser the client sends the cookie to the server and the server checks if the token present in the cookie is still valid. If it is valid then the server sends an ok response to the client and the browser redirects the page to the homepage.
- The user cannot hit on any other page other if the token is not valid.
A screenshot indicating the message from the server if the user hits on a different page when there is no valid token is displayed as below.
-
Users
Design
As shown in the above screenshot, the scoreboard page has a table which has pagination and the search feature enabled.
Implementation
The users page displays all the subscribed users with their details. The phone number, date of subscription and the symptoms are displayed here.
Data Design
- Clicking on the plus button in the table in the users pages displays the symptom that the user has sent to the server.
- Clicking on the delete button will unsubscribe the user from the server. The record will be deleted from the table.
-
Extras
Cookies
The above screenshot shows the token is saved in the form of a cookie which is used for validation when loading the webpage.
Token Expiry
The above screenshot shows the alert message that comes from the server when the token is expired.
-
Endpoints
-
/users
- Takes to the users page which is explained in the second section.
- Before this page is loaded a middleware is called which checks for the token expiry. If the token is not expired then the middleware is passed and the admin moved to this homepage page.