Advertisement
This is comment for paste
mybank.py
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- You can add in your code a hash protection for password and a protection for SQL injection :
- Protection SQL :
- # INSERT avec protection contre les injections SQL
- def insertData(connection, accountno, password, name, amount, phone):
- q = "INSERT INTO accounts(account_no, password, name, amount, phone) VALUES (%s, %s, %s, %s, %s)"
- values = (accountno, password, name, amount, phone)
- execute_query(connection, q, values)
- Hash protection for password :
- import bcrypt
- # Hachage du mot de passe
- def hash_password(password):
- salt = bcrypt.gensalt()
- return bcrypt.hashpw(password.encode('utf-8'), salt)
- # Dans la fonction signup, remplacez la ligne d'insertion par :
- hashed_password = hash_password(password)
- insertData(connection, accountno, hashed_password, name, amount, phone)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement