mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
moar validators
This commit is contained in:
@@ -20,8 +20,11 @@
|
||||
# ========================================================================== #
|
||||
|
||||
|
||||
from typing import List
|
||||
from typing import Any
|
||||
|
||||
from .basic import valid_string_list
|
||||
|
||||
from . import check_re_match
|
||||
|
||||
|
||||
@@ -30,6 +33,10 @@ def valid_user(arg: Any) -> str:
|
||||
return check_re_match(arg, "username characters", r"^[a-z_][a-z0-9_-]*$")
|
||||
|
||||
|
||||
def valid_users_list(arg: Any) -> List[str]:
|
||||
return valid_string_list(arg, subval=valid_user, name="users list")
|
||||
|
||||
|
||||
def valid_passwd(arg: Any) -> str:
|
||||
return check_re_match(arg, "passwd characters", r"^[\x20-\x7e]*\Z$", strip=False, hide=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user