File: secret.py

package info (click to toggle)
python-inquirerpy 0.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,088 kB
  • sloc: python: 9,463; makefile: 15
file content (26 lines) | stat: -rw-r--r-- 879 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from InquirerPy import inquirer
from InquirerPy.validator import PasswordValidator

original_password = "InquirerPy45@"


def main():
    old_password = inquirer.secret(
        message="Old password:",
        transformer=lambda _: "[hidden]",
        validate=lambda text: text == original_password,
        invalid_message="Wrong password",
        instruction="(abc)",
        long_instruction="Original password: InquirerPy45@",
    ).execute()
    new_password = inquirer.secret(
        message="New password:",
        validate=PasswordValidator(length=8, cap=True, special=True, number=True),
        transformer=lambda _: "[hidden]",
        long_instruction="Password require length of 8, 1 cap char, 1 special char and 1 number char.",
    ).execute()
    confirm = inquirer.confirm(message="Confirm?", default=True).execute()


if __name__ == "__main__":
    main()