本文整理汇总了Python中kallithea.model.db.Setting.get_auth_plugins方法的典型用法代码示例。如果您正苦于以下问题:Python Setting.get_auth_plugins方法的具体用法?Python Setting.get_auth_plugins怎么用?Python Setting.get_auth_plugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kallithea.model.db.Setting
的用法示例。
在下文中一共展示了Setting.get_auth_plugins方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_auth_plugins [as 别名]
return htmlfill.render(
render('/login.html'),
defaults=errors.value,
errors=errors.error_dict or {},
prefix_error=False,
encoding="UTF-8",
force_defaults=False)
except UserCreationError, e:
# container auth or other auth functions that create users on
# the fly can throw this exception signaling that there's issue
# with user creation, explanation should be provided in
# Exception itself
h.flash(e, 'error')
# check if we use container plugin, and try to login using it.
auth_plugins = Setting.get_auth_plugins()
if any((importplugin(name).is_container_auth for name in auth_plugins)):
from kallithea.lib import auth_modules
try:
auth_info = auth_modules.authenticate('', '', request.environ)
except UserCreationError, e:
log.error(e)
h.flash(e, 'error')
# render login, with flash message about limit
return render('/login.html')
if auth_info:
headers = self._store_user_in_session(auth_info.get('username'))
raise HTTPFound(location=c.came_from, headers=headers)
return render('/login.html')