Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved for authentication #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Klaupaz
Copy link

@Klaupaz Klaupaz commented Jun 26, 2023

hard work but honest :)

Copy link

@jakobj jakobj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks for your contribution! 🎉

i think it would be nice to stick to the api defined here, i.e., separate the authentication from adding the user. furthermore, see some inline comments :)

@@ -21,6 +21,13 @@ def read_pwdb():
def add_user(user, password, pwdb):
if user not in pwdb:
pwdb[user] = password

elif user in pwdb:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif user in pwdb:
else:

should be sufficient, since user in pwdb should always be true if user not in pwdb is false, right?

elif user in pwdb:
if password == pwdb[user]:
print("Successfully aunthenticated!")
if password != pwdb[user]:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if password != pwdb[user]:
else:

same effect, but more readable and safe


elif user in pwdb:
if password == pwdb[user]:
print("Successfully aunthenticated!")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print("Successfully aunthenticated!")
print("Successfully authenticated!")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants