I am coding a website for a local HOA and one of their requests was to make the website locked behind a username and password authentication. I have everything working from the front end using javascript and html. When a user visits the site they are redirected to my login.html in order to enter a username and password. If they enter valid credentials it allows them to view the remaining content on the website, and if they don’t it prompts them to try again without letting them view. This all works perfectly, however; I am storing my usernames and passwords in my login.js file which is on the front end so when a user inspects the code they have access to all users credentials.
I am wondering what is the best way to securely manage these passwords. I have tried setting up a MongoDB and node.js but can’t get my database to connect with my code to save my life. I do have a script where I hashed all the passwords using Bcrypt but that still doesn’t solve where I should store these passwords where they well be unaccessible to someone inspecting the code. I am willing to try whatever the security doesn’t need to be top-notch just making sure the average person isn’t able to just inspect and log into my website. I am storing some addresses and contacts for local high profile people so they don’t want information on public domain.
Landon Holmberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.