Python Login Validator

Source: Internet
Author: User

Fuctions: Login authentication, hidden input password, the same user 3 times input wrong password lock the account, if the user name is Yooma password is yooma login success Prompt Welcome


#!/usr/bin/env python3#auther:yooma 2016-08-15 15:00import sysimport getpassc =  1uname = []while 1:    username = input ("Input  Username: ")     password = getpass.getpass (" Input password: ")      lockfile = open (' Lock.txt ', ' R ')     try:         if username == ():             print ("%s user locked.")  % username)             sys.exit (0)     finally:        lockfile.close ()      if username ==  ' Yooma '  and password ==  ' Yooma ':         print ("welcome %s login success!"  % username)         break    elif  username !=  ' Yooma '  or password !=  ' Yooma ':         print ("Username or password failed,please input again:")          uname.insert (C,username)         s  = set (uname)         for i in s:            if c < 4 and uname.count (i)  == 3:                Lockfile = open (' Lock.txt ', ' W ')                 try:                     lockfile.write (username)                 finally:                    lockfile.close ()                     print ("your account is locked.")                     sys.exit (0)            elif c == 3:                print ("Input  Error 3 times,go out. ")                sys.exit (0)          c+=1        continue &Nbsp;  else:        print ("Input error.")         break

This article is from the "Yooma Technology blog" blog, please be sure to keep this source

Python Login Validator

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: 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.