05/07 Phase 3: initial codes
This commit is contained in:
@@ -104,3 +104,12 @@ def validate_setting_key(key: str) -> bool:
|
||||
"""Return True if key is a valid setting key (alphanumeric, underscores, dots)."""
|
||||
import re
|
||||
return bool(key and re.match(r'^[a-zA-Z0-9_.]+$', key) and len(key) <= 100)
|
||||
|
||||
|
||||
def validate_passcode(passcode: str, min_len: int = 4, max_len: int = 6) -> bool:
|
||||
"""Return True if passcode is digits only and within the allowed length range."""
|
||||
return (
|
||||
bool(passcode)
|
||||
and passcode.isdigit()
|
||||
and min_len <= len(passcode) <= max_len
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user