当前位置: 首页>>代码示例>>Python>>正文


Python UserEntityManager.findUserEntityByAccount方法代码示例

本文整理汇总了Python中user.userentitymanager.UserEntityManager.findUserEntityByAccount方法的典型用法代码示例。如果您正苦于以下问题:Python UserEntityManager.findUserEntityByAccount方法的具体用法?Python UserEntityManager.findUserEntityByAccount怎么用?Python UserEntityManager.findUserEntityByAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user.userentitymanager.UserEntityManager的用法示例。


在下文中一共展示了UserEntityManager.findUserEntityByAccount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: login

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByAccount [as 别名]
    def login(self, loginInfo, _request):
        """
        :type loginInfo: message.gate.gatemsg.SLogin
        :type _request: message.gate.ilogin.ILogin_Login_Request
        """

        Logger.log("ILoginImpl.login: ", loginInfo.account)

        userEntity = UserEntityManager.findUserEntityByAccount(loginInfo.account)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorLogin_InvalidLoginInfo")

        if not userEntity.isPasswordValid(loginInfo.password):
            ErrorCodeManager.raiseError("ErrorLogin_InvalidLoginInfo")

        if not userEntity.isDataLoaded():
            userDataView = UserDbHelper.loadUserDataView(userEntity.getUserId())
            userEntity.updateUserData(userDataView)

        sessionKey = MyUuid.getUuid()
        userEntity.updateDeviceCodeAndSessionKey(loginInfo.deviceCode, sessionKey)
        UserEntityManager.onUserLogin(userEntity, _request.connId, loginInfo.deviceCode)

        loginReturn = userEntity.getLoginReturn()
        _request.response(loginReturn)

        DbSaver.saveTable(userEntity.getTUserSettings())
        DbSaver.saveTable(userEntity.getTUserBasic())
开发者ID:bropony,项目名称:gamit,代码行数:30,代码来源:iloginimpl.py

示例2: signup

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByAccount [as 别名]
    def signup(self, signupInfo, _request):
        """
        :type signupInfo: message.gate.gatemsg.SSignup
        :type _request: message.gate.ilogin.ILogin_Signup_Request
        """

        if not signupInfo.account:
            ErrorCodeManager.raiseError("ErrorSignup_invalidAccount")

        if not signupInfo.password:
            ErrorCodeManager.raiseError("ErrorSignup_invalidPassword")

        if not ELoginType.isValueValid(signupInfo.loginType):
            ErrorCodeManager.raiseError("ErrorSignup_invalidLoginType")

        userEntity = UserEntityManager.findUserEntityByAccount(signupInfo.account)
        if userEntity:
            ErrorCodeManager.raiseError("ErrorLogin_AccountExists")

        if signupInfo.loginType == ELoginType.MobilePhoneNum:
            if ServerConfigManager.isValidationCodeEnabled:
                if not PhoneValidationManager.isValidationCodeValid(signupInfo.validationCode, signupInfo.account):
                    ErrorCodeManager.raiseError("ErrorLogin_InvalidValidationCode")
                else:
                    PhoneValidationManager.removeValidationCode(signupInfo.account)

        dataView = UserDbHelper.createAccount(signupInfo)
        userEntity = UserEntity(dataView.basicInfo)
        userEntity.updateUserData(dataView)
        UserEntityManager.addUser(userEntity)

        userEntity.updateDeviceCodeAndSessionKey(signupInfo.deviceCode, MyUuid.getUuid())
        UserEntityManager.onUserLogin(userEntity, _request.connId, signupInfo.deviceCode)

        _request.response(userEntity.getLoginReturn())

        # save changes
        DbSaver.saveTable(userEntity.getTUserSettings())

        # logging
        DbLogHepler.logSignup(userEntity.getLogUserInfo())
开发者ID:bropony,项目名称:gamit,代码行数:43,代码来源:iloginimpl.py

示例3: resetPhoneUserPassword

# 需要导入模块: from user.userentitymanager import UserEntityManager [as 别名]
# 或者: from user.userentitymanager.UserEntityManager import findUserEntityByAccount [as 别名]
    def resetPhoneUserPassword(self, phoneNum, validationCode, newPassword, _request):
        """
        :type phoneNum: str
        :type validationCode: str
        :type newPassword: str
        :type _request: message.gate.ilogin.ILogin_Resetphoneuserpassword_Request
        """

        userEntity = UserEntityManager.findUserEntityByAccount(phoneNum)
        if not userEntity:
            ErrorCodeManager.raiseError("ErrorLogin_noSuchPhoneRegistered")

        if userEntity.getTUserBasic().accountType != ELoginType.MobilePhoneNum:
            ErrorCodeManager.raiseError("ErrorLogin_noPhoneNumLoginType")

        if not PhoneValidationManager.isValidationCodeValid(validationCode, phoneNum):
            ErrorCodeManager.raiseError("ErrorLogin_InvalidValidationCode")
        else:
            PhoneValidationManager.removeValidationCode(phoneNum)

        userEntity.getTUserBasic().password = Md5Hash.encryptPassword(newPassword)
        DbSaver.saveTable(userEntity.getTUserBasic())

        _request.response()
开发者ID:bropony,项目名称:gamit,代码行数:26,代码来源:iloginimpl.py


注:本文中的user.userentitymanager.UserEntityManager.findUserEntityByAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。