本文整理汇总了Python中MaKaC.authentication.AuthenticatorMgr.getIdentityById方法的典型用法代码示例。如果您正苦于以下问题:Python AuthenticatorMgr.getIdentityById方法的具体用法?Python AuthenticatorMgr.getIdentityById怎么用?Python AuthenticatorMgr.getIdentityById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.authentication.AuthenticatorMgr
的用法示例。
在下文中一共展示了AuthenticatorMgr.getIdentityById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GenericCache
# 需要导入模块: from MaKaC.authentication import AuthenticatorMgr [as 别名]
# 或者: from MaKaC.authentication.AuthenticatorMgr import getIdentityById [as 别名]
class RHResetPasswordBase:
_isMobile = False
_token_storage = GenericCache('resetpass')
def _checkParams(self, params):
self._token = request.view_args['token']
self._data = self._token_storage.get(self._token)
if not self._data:
raise NoReportError(_('Invalid token. It might have expired.'))
self._avatar = AuthenticatorMgr().getById(self._data['tag']).getAvatarByLogin(self._data['login'])
self._identity = self._avatar.getIdentityById(self._data['login'], self._data['tag'])
if not self._identity:
raise NoReportError(_('Invalid token (no login found)'))
def _checkParams_POST(self):
self._password = request.form['password'].strip()
if not self._password:
raise FormValuesError(_('Your password must not be empty.'))
if self._password != request.form['password_confirm'].strip():
raise FormValuesError(_('Your password confirmation is not correct.'))
def _process_GET(self):
return self._getWP().display()
def _process_POST(self):
self._identity.setPassword(self._password.encode('utf-8'))
self._token_storage.delete(self._token)
url = self._getRedirectURL()
url.addParam('passwordChanged', True)
self._redirect(url)
示例2: _process
# 需要导入模块: from MaKaC.authentication import AuthenticatorMgr [as 别名]
# 或者: from MaKaC.authentication.AuthenticatorMgr import getIdentityById [as 别名]
def _process( self ):
am = AuthenticatorMgr()
for id in self._identityList:
identity = am.getIdentityById(id)
am.removeIdentity(identity)
self._avatar.removeIdentity(identity)
self._redirect( urlHandlers.UHUserDetails.getURL( self._avatar ) )
示例3: _process
# 需要导入模块: from MaKaC.authentication import AuthenticatorMgr [as 别名]
# 或者: from MaKaC.authentication.AuthenticatorMgr import getIdentityById [as 别名]
def _process( self ):
authManager = AuthenticatorMgr()
for i in self._identityList:
identity = authManager.getIdentityById(i)
if len(identity.getUser().getIdentityList()) > 1:
authManager.removeIdentity(identity)
self._avatar.removeIdentity(identity)
self._redirect( urlHandlers.UHUserDetails.getURL( self._avatar ) )