mirror of
https://github.com/wassname/flask-security.git
synced 2026-07-18 12:20:29 +08:00
Add kwargs for configurable forms.
Specifically list out the kwargs so we'll get an interpreter error on a bad name.
This commit is contained in:
+16
-3
@@ -184,7 +184,9 @@ def _get_state(app, datastore, **kwargs):
|
||||
_send_mail_task=None
|
||||
))
|
||||
|
||||
kwargs.update(_default_forms)
|
||||
for key, value in _default_forms.items():
|
||||
if key not in kwargs or not kwargs[key]:
|
||||
kwargs[key] = value
|
||||
|
||||
return _SecurityState(**kwargs)
|
||||
|
||||
@@ -293,7 +295,11 @@ class Security(object):
|
||||
if app is not None and datastore is not None:
|
||||
self._state = self.init_app(app, datastore, **kwargs)
|
||||
|
||||
def init_app(self, app, datastore=None, register_blueprint=True, **kwargs):
|
||||
def init_app(self, app, datastore=None, register_blueprint=True,
|
||||
login_form=None, confirm_register_form=None,
|
||||
register_form=None, forgot_password_form=None,
|
||||
reset_password_form=None, send_confirmation_form=None,
|
||||
passwordless_login_form=None):
|
||||
"""Initializes the Flask-Security extension for the specified
|
||||
application and datastore implentation.
|
||||
|
||||
@@ -311,7 +317,14 @@ class Security(object):
|
||||
|
||||
identity_loaded.connect_via(app)(_on_identity_loaded)
|
||||
|
||||
state = _get_state(app, datastore)
|
||||
state = _get_state(app, datastore,
|
||||
login_form=login_form,
|
||||
confirm_register_form=confirm_register_form,
|
||||
register_form=register_form,
|
||||
forgot_password_form=forgot_password_form,
|
||||
reset_password_form=reset_password_form,
|
||||
send_confirmation_form=send_confirmation_form,
|
||||
passwordless_login_form=passwordless_login_form)
|
||||
|
||||
if register_blueprint:
|
||||
app.register_blueprint(create_blueprint(state, __name__))
|
||||
|
||||
Reference in New Issue
Block a user