Concept Flow - User authentication basics
Start
User enters username
User enters password
Check if username exists
Yes/No
Check password
The flow shows how a system asks for username and password, checks them, and either grants or rejects access.
users = {'alice': '1234', 'bob': 'abcd'}
username = input('Username: ')
password = input('Password: ')
if username in users and users[username] == password:
print('Access granted')
else:
print('Access denied')| Step | Action | Input/Check | Result | Output |
|---|---|---|---|---|
| 1 | Ask for username | User types 'alice' | username = 'alice' | |
| 2 | Ask for password | User types '1234' | password = '1234' | |
| 3 | Check if username in users | 'alice' in users | True | |
| 4 | Check if password matches | users['alice'] == '1234' | True | |
| 5 | Decision | Both checks True | Access granted | Access granted |
| 6 | End | No more steps |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | After Step 4 | Final |
|---|---|---|---|---|---|---|
| username | '' | 'alice' | 'alice' | 'alice' | 'alice' | 'alice' |
| password | '' | '' | '1234' | '1234' | '1234' | '1234' |
User authentication basics: - Ask user for username and password - Check if username exists in stored data - Verify password matches stored password - Grant access if both checks pass - Otherwise, deny access