'Password Protected site without username Amplify AWS
I am trying to set up a simple password protected website. I have a main page that is a landing page with an input box for the site password on it. The users will enter the password and then be routed to a different main page with content and a the rest of the sites links. Currently I am attempting to do this on AWS Amplify with a static site but with no lick. I have also tired to use Google Firebase again with no luck.
Ideally it is something that will do a check to an environment variable that contains the password on the server side. I am attempting to run this server less so the following implementation methods would not work. It is similar to how they do it Here, but on a static hosting service like AWS Amplify or Google Firebase.
This is how I would look to do it with Flask. I am still trying to learn reactjs so if there is some way to securely do a check similar with it before loading each page that would be ideal.
@app.route('/', methods=["GET" , "POST"])
def homePage():
if current_user.is_authenticated:
return render_template("homepage.html")
if request.method == "GET":
return render_template("login.html")
Then simply add the check for is user authenticated before loading each page and if not dump back to the landing login page. All of the other solutions that I have seen 1, do not allow for custom landing pages where the password is entered (this is a MUST have) and 2 also require that there is a username in addition to the password, again this is a must that there is not and it will only require the user knowing the generic password.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
