Skip to content

Authentication

Joshua C. Dargan edited this page Dec 7, 2021 · 2 revisions

Login Page

The student facing portion of Edugator does not have a link or button to direct you to the Login Page. You must go directly to: https://edugator.app/admin/login

This was done to obfuscate the login page and admin side from students. However, seeing as there are web crawlers and this is an open-source project, a dedicated cyber sleuth can easily find the location of the login page.

Login Page Functionality

The login page is built using Formik for the form and Material UI and Emotion for the components.

If the user successfully logins, the token is stored in Local Storage using the LocalStorage wrapper. The token will persist for 24 hours.

Resources

Local Storage https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Formik login code and tutorial https://www.youtube.com/watch?v=6VmVYi9yrAA&t=2s https://github.com/benawad/react-typescript-material-ui-form/blob/master/src/MyForm.tsx

Private Route

The private route class displays the child components if there is a token found with LocalStorage.getToken(). If there is no token, it automatically redirects the user to the admin login page.

If the token is invalid, the token is removed in the apiClient (see State Management).

Clone this wiki locally