Publish curated ITWorx-ModelForge source from 990401737f96c8d46a9f7b0d84994516cadcb6a0
This commit is contained in:
1 parent
7082ab955a
commit
848f0d8f8a
434 files changed
+67298
-4315
No files matched your search
@@ -0,0 +1,20 @@
|
||||
"""Produce a salted password verifier without putting plaintext in command arguments."""
|
||||
|
||||
import getpass
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "backend" / "src"))
|
||||
from modelforge_api.services.operator_password import hash_password
|
||||
|
||||
if __name__ == "__main__":
|
||||
password = (
|
||||
getpass.getpass("Operator password: ")
|
||||
if sys.stdin.isatty()
|
||||
else sys.stdin.readline(4098).rstrip("\r\n")
|
||||
)
|
||||
try:
|
||||
print(hash_password(password))
|
||||
except (ValueError, UnicodeError):
|
||||
print("Invalid password: enter 1 to 1024 characters.", file=sys.stderr)
|
||||
raise SystemExit(2) from None
|
||||
Reference in new issue
Block a user