def login(user,passwd): configData = sql.readConfig() passwd = utils.encrypt(passwd) userInfo = configData.get('admin') if user==userInfo.get('user') and passwd==userInfo.get('password'): return True print u"用户或者密码错误" return False
def login(user, passwd): configData = sql.readConfig() passwd = utils.encrypt(passwd) userInfo = configData.get('admin') if user == userInfo.get('user') and passwd == userInfo.get('password'): return True print u"用户或者密码错误" return False
def setAdminUserAndPwd(): user = inputUser() if not user:return False passwd = inputPasswd() if not passwd:return False passwd = utils.encrypt(passwd) config = {"admin":{'user':user,'password':passwd}} return setConfig(config)
def login(user, passwd): userInfo = sql.getUser(user) if not userInfo: print u"用户或者密码错误" return False passwd = utils.encrypt(passwd) if user == userInfo.get('user') and passwd == userInfo.get('password'): return True print u"用户或者密码错误" return False
def login(user,passwd): userInfo = sql.getUser(user) if not userInfo: print u"用户或者密码错误" return False passwd = utils.encrypt(passwd) if user==userInfo.get('user') and passwd==userInfo.get('password'): return True print u"用户或者密码错误" return False
def setAdminUserAndPwd(): user = inputUser() if not user: return False passwd = inputPasswd() if not passwd: return False passwd = utils.encrypt(passwd) config = {"admin": {"user": user, "password": passwd}} return setConfig(config)
def apply(): """ 注册商城用户 """ print u"\n\n\n +++++++++++++你已经进入商城注册中心 : +++++++++++++ " try: user = inputUser() #读入用户名 passwd = inputPwd() #输入密码 passwd = utils.encrypt(passwd) userInfos = {'user': user, 'password': passwd} sql.addNewUser(userInfos) #写库 except MyException, e: print e return False
def resetPwd(): """ 重置密码 """ print u"\n\n\n +++++++++++++你已经进入商城重置密码中心 :+++++++++++++ " if not login.loginStart(): print (u"登录失败,不能重置密码") return False try: print (u"---------------重置密码-----------------") passwd = register.inputPwd() #输入新密码 passwd = utils.encrypt(passwd) user = sql.readLoginUser() sql.updateUser(user,{'password':passwd}) #更新数据 except MyException,e: print e return False
def resetPwd(): """ 重置密码 """ print u"\n\n\n +++++++++++++你已经进入商城重置密码中心 :+++++++++++++ " if not login.loginStart(): print(u"登录失败,不能重置密码") return False try: print(u"---------------重置密码-----------------") passwd = register.inputPwd() #输入新密码 passwd = utils.encrypt(passwd) user = sql.readLoginUser() sql.updateUser(user, {'password': passwd}) #更新数据 except MyException, e: print e return False