User management program for Python jobs not completed

Source: Internet
Author: User

admin|admin123.| 28812341026| [Email protected]|1
root|admin123.| 134456634887| [Email protected]|1
bob|admin123.| 1301231576356| [Email protected]|0
cevin|admin123.| 45566778990| [Email protected]|0



#Auther Bob
#--*--conding:utf-8--*--
#1, ordinary users
# login, register, change password, view this user information

#2, Admin user
# login, register, change password, view this user information
# Delete Normal virtual machine, add normal user information
# View all normal users, search for user information according to specified keywords
# Improve permissions for ordinary users

#3, requirements
# Permissions with adorners
#用户信息, with file storage

#4, File contents
# User name | password | mobile phone number | Email address | user type

Login_dict = {"Is_login": None, "login_type": none}
Login_list = []
User_list = []
Tmpe_user_list = []
With open ("db", "R", encoding= "Utf-8") as F:
For line in F:
Tmpe_user_list = Line.strip (). Split ("|")
User_list.append (Tmpe_user_list[0])
Tmpe_user_list = []


def manage_user (func):
def inner (*args,**kwargs):
If login_dict["is_login"] = = "1" and login_dict["login_type"] = = "1":
ret = func (*args,**kwargs)
return ret
Elif login_dict["Is_login"] = = None:
Print ("Please login First")
Login ()
Elif login_dict["Is_login"] = = 1 and login_dict["login_type"] = = None:
Print ("Please login with Administrator account")
Else
Pass
return inner


def common_user (func):
def inner (*args,**kwargs):
If login_dict["is_login"] = = None:
Print ("Please login First")
Login ()
Elif login_dict["Is_login"] = = 1:
ret = func ()
return ret
return inner


def login ():
user_name = input ("Please enter user name:")
USER_PASSWD = input ("Please enter the password for%s:"% (user_name))
If user_name in User_list:
With open ("db", "R", encoding= "Utf-8") as F:
For line in F:
Login_list = Line.strip (). Split ("|")
if user_name = = Login_list[0] and user_passwd = = Login_list[1]:
Print ("Welcome% (name) login management platform"%{"name": user_name})
If login_list[4] = = 1:
login_dict["Is_login"] = 1
login_dict["login_type"] = 1
Else
login_dict["Is_login"] = 1
login_dict["login_type"] = None
Break
Else
Print ("Username or password is wrong, please re-login:")
login_dict["Is_login"] = None
login_dict["login_type"] = None
Login ()
Else
Print ("Username or password is wrong, please login again")
login_dict["Is_login"] = None
login_dict["login_type"] = None
Login ()



Def regi ():
Login_name = input ("Please enter a username to register:")
If login_name in User_list:
Print ("The user name already exists, please re-enter the registered username")
Regi ()
Else
LOGIN_PASWD = input ("Please enter the mailbox password for%s"% (login_name))
Login_number = input ("Please enter the phone number of%s"% (login_name))
Login_email = input ("Please enter the mailbox address for%s"% (login_name))
While True:
If login_dict["is_login"] = = 1 and login_dict["login_type"] = = 1:
option = input ("Please enter%s user type \n1: Administrator \n2: normal user \ n"% (login_name))
if option = = "1":
Login_type = 1
Break
elif option = = "2":
Login_type = 0
Break
Else
Print ("Invalid input, please re-enter")
Elif login_dict["Is_login"] = = 1 and login_dict["login_type"] = = None:
option = input ("Please enter%s user type \n1: normal user \ n"% (login_name))
if option = = "1":
Login_type = 0
Break
Else
Print ("Invalid input, please re-enter")
Else
Pass
With open ("db", "a", encoding= "Utf-8") as F:
User_info = "\ n" + login_name + "|" + login_paswd + "|" + Login_number + "|" + Login_email + "|" + login_type
F.write (User_info)







Def Change_password ():
Pass


Def view_user ():
Pass


Def add_user ():
Pass


Def del_user ():
Pass


Def search ():
Pass

User management program for Python jobs not completed

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.