mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 17:11:52 +08:00
improved security checks
This commit is contained in:
@@ -43,5 +43,7 @@ class Plugin(BaseAuthService):
|
||||
}
|
||||
|
||||
async def authorize(self, user: str, passwd: str) -> bool:
|
||||
assert user == user.strip()
|
||||
assert user
|
||||
htpasswd = passlib.apache.HtpasswdFile(self.__path)
|
||||
return htpasswd.check_password(user, passwd)
|
||||
|
||||
@@ -71,6 +71,8 @@ class Plugin(BaseAuthService):
|
||||
}
|
||||
|
||||
async def authorize(self, user: str, passwd: str) -> bool:
|
||||
assert user == user.strip()
|
||||
assert user
|
||||
session = self.__ensure_session()
|
||||
try:
|
||||
async with session.request(
|
||||
|
||||
@@ -67,6 +67,8 @@ class Plugin(BaseAuthService):
|
||||
}
|
||||
|
||||
async def authorize(self, user: str, passwd: str) -> bool:
|
||||
assert user == user.strip()
|
||||
assert user
|
||||
async with self.__lock:
|
||||
return (await aiotools.run_async(self.__inner_authorize, user, passwd))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user