Fixed asking for username
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
from .healthchecks import health_database_status
|
||||
from .security import security, user_datastore
|
||||
from .security import security, init_security_real_good
|
||||
from .config import Config
|
||||
@@ -1,5 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from flask_security import Security, SQLAlchemyUserDatastore
|
||||
from flask_security.forms import RegisterForm, Required
|
||||
from wtforms import StringField
|
||||
|
||||
from models import db, User, Role
|
||||
|
||||
"""
|
||||
Flask-Security
|
||||
"""
|
||||
@@ -9,9 +15,14 @@ __copyright__ = "Copyright 2020, UnstableVortex Team"
|
||||
__module_name__ = "security"
|
||||
__version__text__ = "1"
|
||||
|
||||
from flask_security import Security, SQLAlchemyUserDatastore
|
||||
|
||||
from models import db, User, Role
|
||||
class ExtendedRegisterForm(RegisterForm):
|
||||
name = StringField('Username', [Required()])
|
||||
|
||||
|
||||
user_datastore = SQLAlchemyUserDatastore(db, User, Role)
|
||||
security = Security()
|
||||
security = Security() # Will be initiated at init_app
|
||||
|
||||
|
||||
def init_security_real_good(app):
|
||||
security.init_app(app, datastore=user_datastore, register_form=ExtendedRegisterForm)
|
||||
|
||||
Reference in New Issue
Block a user