gpt4 book ai didi

python - stormpath - 如何控制使用的目录

转载 作者:太空宇宙 更新时间:2023-11-04 03:00:24 26 4
gpt4 key购买 nike

使用 Flask-Stormpath pip。这是设置

app.config['STORMPATH_APPLICATION'] = my_app_name

我在 docs 中没有看到任何 STORMPATH_DIRECTORY 设置|允许开发人员将 applicationA 与多个目录一起使用。

编辑:对于登录,我提取了 authenticate_password 方法我可以像兰德尔所说的那样通过特定的导演

 authenticate_password(username, password, account_store=self.directory)

对于用户注册,我好像找不到解决办法

这就是我在我的一个应用程序中注册的方式:

authenticate_password(用户名, 密码, account_store=self.directory)

from flask.ext.stormpath import User as StormpathUser
data = {
'email': self._api_user_name_to_email(username),
'password': password,
'given_name': username,
'surname': username,

}
StormpathUser.create(**data)

知道如何在特定目录中明确注册用户吗?

最佳答案

目前还不支持(首选目录)。在集成中,默认使用您的第一优先级目录来创建新用户等。

如果这对您的用例不起作用,您可以使用 stormpath_manager.application 对象在您想要的任何目录中手动创建用户。

如:

stormpath_manager.application.create_account({...}, account_store=some_other_directory)

关于python - stormpath - 如何控制使用的目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41083777/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com