def setCookie(username): try: encryptData = encrypt(bytes(username, encoding='utf-8'), key, iv) resp = make_response(MSG.Success(msg="success")) encryptData = str(encryptData, encoding='utf-8') resp.set_cookie('id', encryptData, max_age=3600) return resp except TypeError: logger.error("%s encrypt string argument without an encoding." % bad) except Exception as e: logger.error("%s {}".format(e) % bad)
def delCookie(): resp = make_response(MSG.Success()) resp.delete_cookie('id') return resp