官术网_书友最值得收藏!

Authentication

In order to develop an authentication module, we are going to use the Flask-Login extension. The Flask-Login extension provides a user session management mechanism. It handles the common tasks for managing user sessions such as logging in, logging out, and remembering the user.

To integrate Flask-Login, you need to create the instance and define some default parameters, as described in the following code snippet:

from flask_login import LoginManager
app = Flask(__name__)
login_manager = LoginManager()
login_manager.session_protection = 'strong'
login_manager.login_view = 'auth.login'
login_manager.login_message_category = "info"
login_manager.init_app(app)

We are going to create an authentication module as an auth package. An auth package will have basic scaffolding, as shown here:

主站蜘蛛池模板: 金湖县| 嘉荫县| 漳州市| 秀山| 景德镇市| 南通市| 宾川县| 珠海市| 乌什县| 五河县| 天峨县| 双桥区| 泾源县| 额敏县| 霍州市| 庆城县| 渭源县| 古交市| 湟源县| 宁乡县| 江达县| 会宁县| 巨野县| 绍兴市| 武安市| 二连浩特市| 沈阳市| 贞丰县| 额尔古纳市| 德阳市| 重庆市| 阿拉尔市| 鲜城| 济源市| 罗平县| 商水县| 邛崃市| 玛纳斯县| 包头市| 榆树市| 祁门县|