import time
user,passwd = 'lian','abc123'
def auth(func):
def wrapper(*args,**kwargs):
username = input("Username:").strip()
password = input("Password:").strip()
if user == username and passwd == password:
print(' 33[32;1mUser has passed authentication 33[0m')
func(*args,**kwargs)
else:
exit(" 33[32;1mInvalid username or password 33[0m")
return wrapper
def index():
print('welcome to index page')
@auth
def home():
print('welcome to home page')
@auth
def bbs():
print("welcome to bbs page")
index()
home()
bbs()