flask login

最近手上有个项目使用了flask_security这个模块进行用户的登陆注册,后台主要自己使用,放在公网上怕有人随意注册,所以就准备关闭注册接口。关闭注册,有两个地方需要修改。

关闭注册节点

在代码中添加

1
app.config['SECURITY_REGISTERABLE'] = False

在web页面去掉注册按钮

一般登陆页面会存在注册的进入入口,登陆页面一般是模板提供,所以就需要重写模板,重新模板的方法如下:

  1. Create a folder named security within your application’s templates folder
  2. Create a template with the same name for the template you wish to override