Day 070 - Project 70 : Storing an Admin password

If you have any questions, comments or issues with this project please post them here!

I am a bit confused as why David is using 4 secrets. I made my code with just two.
Can someone explain to me, why it’s better the way David does it?

import os

password = os.environ['password'] 
dave = os.environ['dave'] 
admin01 = os.environ['admin01'] 

user = input("Username > ")
userPass = input("Password > ")

if user == "dave" and userPass == dave:
  print("Welcome Normy.")
elif user == "admin01" and userPass == admin01:
  print("Welcome Admin.")
else: 
  print("User or Password Incorrect")

as per the video, it’s important that the usernames of the login information are also protected which is why he stores it in an env var

3 Likes

that makes an aweful lot of sense of course !! duh😅

1 Like

Yes I did it this way too before opening the answer. I left my normie and admin that way but included a super user with 2No. secrets.

1 Like