SECURITY_PASSWORD_SALT must not be None - flask security

不想你离开。 提交于 2019-12-13 14:12:44

问题


This question is related to: Unique Salt per User using Flask-Security, but I'm more concerned with removing this error message.

The linked question established that flask-security uses per-user salts, which is good since a global salt is pointless.

So my question is what's the point of this configuration variable, and what should I set it to to resolve this error? Does it matter what I set it to?
I don't think I need a global salt since flask-security uses passlib which takes care of salts for me.

(The error message in the title occurs even when copying the example straight from the docs: (peewee example))


回答1:


The global "salt" you specify in SECURITY_PASSWORD_SALT is combined with the unique salt generated for each password that gets created. That combined value is then used to salt the password when it gets hashed. So yes, you do need to set this, it's not a spurious error.

(Others have noted that it's quite confusing to refer to this as a salt, when that strongly implies that the value in this variable is going to be used to salt the password for every user. Fortunately, that's not what happens.)

Here are some options for generating a random string.



来源:https://stackoverflow.com/questions/52662675/security-password-salt-must-not-be-none-flask-security

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!