mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
refactoring
This commit is contained in:
parent
3f6d13af30
commit
49aca90c2e
@ -74,7 +74,7 @@ class Plugin(BaseAuthService):
|
|||||||
async def authorize(self, user: str, passwd: str) -> bool:
|
async def authorize(self, user: str, passwd: str) -> bool:
|
||||||
assert user == user.strip()
|
assert user == user.strip()
|
||||||
assert user
|
assert user
|
||||||
session = self.__ensure_session()
|
session = self.__ensure_http_session()
|
||||||
try:
|
try:
|
||||||
async with session.request(
|
async with session.request(
|
||||||
method="POST",
|
method="POST",
|
||||||
@ -101,7 +101,7 @@ class Plugin(BaseAuthService):
|
|||||||
await self.__http_session.close()
|
await self.__http_session.close()
|
||||||
self.__http_session = None
|
self.__http_session = None
|
||||||
|
|
||||||
def __ensure_session(self) -> aiohttp.ClientSession:
|
def __ensure_http_session(self) -> aiohttp.ClientSession:
|
||||||
if not self.__http_session:
|
if not self.__http_session:
|
||||||
kwargs: Dict = {}
|
kwargs: Dict = {}
|
||||||
if self.__user:
|
if self.__user:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user