File: password_confirm.py

package info (click to toggle)
python-questionary 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 960 kB
  • sloc: python: 3,917; makefile: 66
file content (21 lines) | stat: -rw-r--r-- 520 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
import questionary


def create_password(**kwargs):
    x = questionary.password("Password", **kwargs).ask()
    y = questionary.password("Repeat password", **kwargs).ask()

    if x == y:
        questionary.print("✅ ")
        return x

    else:
        questionary.print(
            "Passwords do not match. Try again.", style="italic fg:darkred"
        )
        # until passwords match, we keep repeating the question
        return create_password(**kwargs)


if __name__ == "__main__":
    create_password()