def authenticat(self, login_info): """认证用户""" auth = auth_user.User_operation() # 创建认证实例 result = auth.authentication(login_info) # 认证用户 if result: return "200", result else: return "400", result
def create_db(): '''创建用户数据库文件''' user_database = {} encryption = auth_user.User_operation() limitsize = settings.LIMIT_SIZE for k, v in settings.USERS_PWD.items(): username = k password = encryption.hash(v) user_db_path = settings.DATABASE + r"\%s.db" % username user_home_path = settings.HOME_PATH + r"\%s" % username user_database["username"] = username user_database["password"] = password user_database["limitsize"] = limitsize user_database["homepath"] = user_home_path if not os.path.isfile(user_db_path): with open(user_db_path, "w") as file: file.write(json.dumps(user_database))
def authenticat(self, login_info): '''Usuário autentificado''' auth = auth_user.User_operation() # Cria a instancia de autentificação result = auth.authentication(login_info) # Usuário autentificado if result: return "200", result else: return "400", result