mirror of
https://github.com/wassname/flask-security.git
synced 2026-06-27 16:10:11 +08:00
register self._state when using init_app
Brings `security.init_app(app)` inline with `security = Security(app)` by registering security._state upon security.init_app. Without this change `security.send_mail_task` will give an infinite recursion error.
This commit is contained in:
@@ -423,7 +423,7 @@ class Security(object):
|
||||
|
||||
identity_loaded.connect_via(app)(_on_identity_loaded)
|
||||
|
||||
state = _get_state(app, datastore,
|
||||
self._state = _get_state(app, datastore,
|
||||
login_form=login_form,
|
||||
confirm_register_form=confirm_register_form,
|
||||
register_form=register_form,
|
||||
@@ -435,11 +435,11 @@ class Security(object):
|
||||
anonymous_user=anonymous_user)
|
||||
|
||||
if register_blueprint:
|
||||
app.register_blueprint(create_blueprint(state, __name__))
|
||||
app.register_blueprint(create_blueprint(self._state, __name__))
|
||||
app.context_processor(_context_processor)
|
||||
|
||||
state.render_template = self.render_template
|
||||
app.extensions['security'] = state
|
||||
app.extensions['security'] = self._state
|
||||
|
||||
return state
|
||||
|
||||
|
||||
Reference in New Issue
Block a user