File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -90,3 +90,27 @@ url_for('simplelogin.login', next='http://myothersite.com/')
9090You can use the ` from werkzeug.security import check_password_hash, generate_password_hash ` utilities to encrypt passwords.
9191
9292A working example is available in ` manage.py ` of [ example app] ( https://github.com/flask-extensions/Flask-SimpleLogin/tree/main/example )
93+
94+ ## Registering Custom Logout Callback(s)
95+
96+ You can define multiple custom logout callbacks to be executed after the user logs out using the ` register_on_logout_callback ` method:
97+
98+ ``` python
99+ from flask import Flask
100+ from flask_simplelogin import SimpleLogin
101+
102+ app = Flask(__name__ )
103+ app.config[' SECRET_KEY' ] = ' something-secret'
104+ simple_login = SimpleLogin(app)
105+
106+ def my_post_logout_callback ():
107+ print (" User has logged out" )
108+
109+ def another_post_logout_callback ():
110+ print (" Another action after logout" )
111+
112+ simple_login.register_on_logout_callback(my_post_logout_callback)
113+ simple_login.register_on_logout_callback(another_post_logout_callback)
114+ ```
115+
116+ The callbacks will be executed in the order they were registered.
You can’t perform that action at this time.
0 commit comments