[PYTHON] user logon is locked due to three logon errors and python User Logon fails.

Source: Internet
Author: User

[PYTHON] user logon is locked due to three logon errors and python User Logon fails.

 
1 #-*-coding: UTF-8-*-2 # Three logon errors: locking users 3 4 # blacklisted users, whitelist users, whitelist User Password 5 with open('black_user.txt ', 'R') as f, \ 6 open('real_username.txt', 'R') as u, \ 7 open('real_password.txt ', 'R ') as p: 8 lock_file = f. read (). strip () 9 user_list = u. read () 10 pass_list = p. read () 11 12 username = input ('Please input your name: ') 13 14 for I in range (1): 15 if lock_file = username: 16 print ('Sorry, your name has B Een locked, please contact your administrator ') 17 exit () 18 elif user_list! = Username: 19 print ('You input username invalid. ') 20 exit () 21 22 # used for counting (for three cycles) 23 count = 024 for i2 in range (3 ): 25 password = input ('Please input your password: ') 26 if password = pass_list: 27 print ('login successfully') 28 exit () 29 else: 30 print ('login failed') 31 count + = 132 33 if count = print ("Your username has been locked, please you will contact your administrator. ") 35 f = open('black_user.txt ', 'A') 36 f. write ('% s \ n' % username) 37 f. close ()

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.