flask-security

How to encrypt password using Python Flask-Security using bcrypt?

How to encrypt password using Python Flask-Security using bcrypt? Question: I’m trying to utlise the standard basic example in the docs for Flask-Security and have made it work except for the password being stored in plaintext. I know this line: user_datastore.create_user(email=’[email protected]’, password=’password’) I could change to: user_datastore.create_user(email=’[email protected]’, password=bcrypt.hashpw(‘password’, bcrypt.gensalt())) But I thought Flask-Security took care …

Total answers: 3

flask-security login via username and not email

flask-security login via username and not email Question: I wanted to have the field in User model that through it the user logs in as username instead of email I defined: app.config[‘SECURITY_USER_IDENTITY_ATTRIBUTES’] = ‘username’ But I’m still getting: user_datastore.add_role_to_user(name, ‘mgmt’) File “/Users/boazin/sentinal/sentinel-cloud/.env/lib/python2.7/site-packages/flask_security/datastore.py”, line 105, in add_role_to_user user, role = self._prepare_role_modify_args(user, role) File “/Users/boazin/sentinal/sentinel-cloud/.env/lib/python2.7/site-packages/flask_security/datastore.py”, line 72, …

Total answers: 4

Testing Flask login and authentication?

Testing Flask login and authentication? Question: I’m developing a Flask application and using Flask-security for user authentication (which in turn uses Flask-login underneath). I have a route which requires authentication, /user. I’m trying to write a unit test which tests that, for an authenticated user, this returns the appropriate response. In my unittest I’m creating …

Total answers: 4