Flask 安全性中没有确认 link
No confirmation link in flask security
我正在使用 flask_security 在烧瓶应用程序中进行注册。注册电子邮件地址时会发送一封确认邮件,但不包含确认邮件 link.
我没有找到激活它的选项,也没有太多关于它的文档。
当前配置为
app = Flask(__name__)
app.config["DEBUG"] = True
app.config["SECRET_KEY"] = "..."
app.config["SECURITY_REGISTERABLE"] = True
app.config["SECURITY_RECOVERABLE"] = True
app.config["SECURITY_TRACKABLE"] = True
app.config["SECURITY_CHANGEABLE"] = True
app.config["SECURITY_PASSWORD_HASH"] = "sha512_crypt"
app.config["SECURITY_PASSWORD_SALT"] = "..."
app.config["SECURITY_CONFIRM_LOGIN_WITHOUT_CONFIRMATION"] = False
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "..."
app.config["MAIL_PASSWORD"] = "..."
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////tmp/flaskpage.db"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
您没有设置所有应该设置的设置。来自 docs
SECURITY_CONFIRMABLE
Specifies if users are required to confirm their email address when registering a new account. If this value is True, Flask-Security creates an endpoint to handle confirmations and requests to resend confirmation instructions. The URL for this endpoint is specified by the SECURITY_CONFIRM_URL
configuration option. Defaults to False
.
你也可以看看代码,它实际上使用它的值来注册你的用户。来自 source code
confirmation_link, token = None, None
...
if _security.confirmable:
confirmation_link, token = generate_confirmation_link(user)
do_flash(*get_message('CONFIRM_REGISTRATION', email=user.email))
所以因为 SECURITY_CONFIRMABLE
没有设置,它的默认值是 False
你不会得到 link.
我正在使用 flask_security 在烧瓶应用程序中进行注册。注册电子邮件地址时会发送一封确认邮件,但不包含确认邮件 link.
我没有找到激活它的选项,也没有太多关于它的文档。
当前配置为
app = Flask(__name__)
app.config["DEBUG"] = True
app.config["SECRET_KEY"] = "..."
app.config["SECURITY_REGISTERABLE"] = True
app.config["SECURITY_RECOVERABLE"] = True
app.config["SECURITY_TRACKABLE"] = True
app.config["SECURITY_CHANGEABLE"] = True
app.config["SECURITY_PASSWORD_HASH"] = "sha512_crypt"
app.config["SECURITY_PASSWORD_SALT"] = "..."
app.config["SECURITY_CONFIRM_LOGIN_WITHOUT_CONFIRMATION"] = False
app.config["MAIL_SERVER"] = "smtp.gmail.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_USERNAME"] = "..."
app.config["MAIL_PASSWORD"] = "..."
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////tmp/flaskpage.db"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
您没有设置所有应该设置的设置。来自 docs
SECURITY_CONFIRMABLE
Specifies if users are required to confirm their email address when registering a new account. If this value is True, Flask-Security creates an endpoint to handle confirmations and requests to resend confirmation instructions. The URL for this endpoint is specified by the
SECURITY_CONFIRM_URL
configuration option. Defaults toFalse
.
你也可以看看代码,它实际上使用它的值来注册你的用户。来自 source code
confirmation_link, token = None, None ... if _security.confirmable: confirmation_link, token = generate_confirmation_link(user) do_flash(*get_message('CONFIRM_REGISTRATION', email=user.email))
所以因为 SECURITY_CONFIRMABLE
没有设置,它的默认值是 False
你不会得到 link.