mirror of
https://github.com/wassname/flask-security.git
synced 2026-08-11 11:18:40 +08:00
Always encrypt password when creating a user
This commit is contained in:
@@ -12,7 +12,7 @@ from flask import current_app
|
||||
from flask.ext.script import Command, Option, prompt_bool
|
||||
from werkzeug.local import LocalProxy
|
||||
|
||||
from flask_security import views
|
||||
from flask_security import views, utils
|
||||
|
||||
|
||||
_datastore = LocalProxy(lambda: current_app.extensions['security'].datastore)
|
||||
@@ -40,6 +40,7 @@ class CreateUserCommand(Command):
|
||||
# sanitize role input a bit
|
||||
ri = re.sub(r'\s', '', kwargs['roles'])
|
||||
kwargs['roles'] = [] if ri == '' else ri.split(',')
|
||||
kwargs['password'] = utils.encrypt_password(kwargs['password'])
|
||||
|
||||
_datastore.create_user(**kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user