本文整理汇总了Python中Authentication.processUserPassword方法的典型用法代码示例。如果您正苦于以下问题:Python Authentication.processUserPassword方法的具体用法?Python Authentication.processUserPassword怎么用?Python Authentication.processUserPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authentication
的用法示例。
在下文中一共展示了Authentication.processUserPassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login
# 需要导入模块: import Authentication [as 别名]
# 或者: from Authentication import processUserPassword [as 别名]
def login(self, sid, login, cpasswd, hostID):
login = login.strip()
if not login:
raise SecurityException("Specify login, please.")
if login in ():
raise SecurityException("Account blocked")
log.debug(sid, 'login', repr(login), 'hostid', hostID)
login = str(login)
challenge = self.sessions[sid].challenge
account = None
# use metaserver login if metaserver is defined
if self.metaserver:
result = self.metaserver.verifyPassword(login, Authentication.processUserPassword(cpasswd, challenge))
if result:
account = Account()
account.login = login
account.nick = result["nick"]
account.email = result["email"]
log.debug("User", login, "has valid metaserver account")
#else:
# raise SecurityException("Wrong login and/or password.")
# local login
# TBD: option to disable local login completely
if not account:
log.debug("Trying local login for user", login)
if not self.accounts.has_key(login):
raise SecurityException('Wrong login and/or password.')
account = self.accounts[login]
if not Authentication.verify(cpasswd, account.passwd, challenge):
raise SecurityException('Wrong login and/or password.')
# setup session
self.sessions[sid].setAttrs(account.login, account.nick, account.email)
account.lastLogin = time.time()
account.addHostID(hostID)
self.tokens[sid] = hashlib.md5(str(random.random())).hexdigest()
return 1, None