rest25/library/crypt.rst => rest262/library/crypt.rst | ||
---|---|---|
46 | A simple example illustrating typical use:: | |
47 | ||
48 | import crypt, getpass, pwd | |
49 | ||
50 | def login(): | |
51 | username = raw_input('Python login:') | |
52 | cryptedpasswd = pwd.getpwnam(username)[1] | |
53 | if cryptedpasswd: | |
t | 54- | if cryptedpasswd == 'x' or cryptedpasswd == '*': |
t | 54+ | if cryptedpasswd == 'x' or cryptedpasswd == '*': |
55 | raise "Sorry, currently no support for shadow passwords" | |
56 | cleartext = getpass.getpass() | |
57 | return crypt.crypt(cleartext, cryptedpasswd) == cryptedpasswd | |
58 | else: | |
59 | return 1 | |
60 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|