0
0
Flaskframework~5 mins

User model with password in Flask - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of hashing passwords in a User model?
Hashing passwords protects user data by converting the password into a secure, unreadable format. This way, even if the database is compromised, the actual passwords are not exposed.
Click to reveal answer
beginner
Which Flask extension is commonly used to hash passwords securely?
Flask-Bcrypt is commonly used to hash passwords securely in Flask applications. It provides easy-to-use methods to hash and check passwords.
Click to reveal answer
beginner
In a Flask User model, why should you never store the password as plain text?
Storing passwords as plain text is risky because if the database is leaked, attackers get direct access to user passwords. Hashing prevents this by storing only the hashed version.
Click to reveal answer
intermediate
What is the typical method name used in a Flask User model to set a password securely?
A typical method is called set_password. It takes the plain password, hashes it, and stores the hashed password in the model.
Click to reveal answer
intermediate
How do you verify a user's password during login in a Flask app?
You use a method like check_password that compares the hashed password stored in the database with the hash of the password entered by the user. If they match, the password is correct.
Click to reveal answer
Which of these is the safest way to store user passwords in Flask?
AHash passwords using Flask-Bcrypt
BStore passwords as plain text
CEncrypt passwords with reversible encryption
DStore passwords in cookies
What does the set_password method usually do in a Flask User model?
AHashes the password and stores it
BStores the password as plain text
CDeletes the password
DSends the password by email
Which Flask extension helps with password hashing?
AFlask-Login
BFlask-Mail
CFlask-Bcrypt
DFlask-WTF
Why should passwords never be stored in plain text?
AIt makes the database slower
BIt risks exposing user passwords if leaked
CIt wastes storage space
DIt is required by Flask
How do you check if a password entered by a user matches the stored password?
ACompare plain text passwords directly
BUse a random number generator
CSend password to admin for verification
DHash the entered password and compare with stored hash
Explain how to create a User model in Flask that securely handles passwords.
Think about how to protect user passwords from being stolen.
You got /4 concepts.
    Describe the steps to verify a user's password during login in a Flask app.
    Focus on how to safely check passwords without revealing them.
    You got /4 concepts.