Exemplo n.º 1
0
def login():
    while True:
        name=input('please input your username>>:').strip()
        password=input('plesae input your password>>:').strip()
        flag,msg=common_interface.login(name,password,'teacher')
        if flag:
            user_data['name']=name
            print(msg)
            break
        else:print(msg)
Exemplo n.º 2
0
def login():
    while True:
        username = input('请输入用户名:').strip()
        pwd = input('请输入密码:').strip()
        flag, msg = common_interface.login(username, pwd, user_type='teacher')
        if flag:
            user_state['user'] = username  # 记录当前用户状态
            print(msg)
            break
        else:
            print(msg)
Exemplo n.º 3
0
def login():
    if user_data['name']:
        print('你已注册,并处于登陆状态')
        return
    while True:
        name = input('please input youe username>>:').strip()
        password = input('please input your password>>:').strip()
        flag, msg = common_interface.login(name, password, 'admin')
        if flag:
            user_data['name'] = name
            print(msg)
            break
        else:
            print(msg)
Exemplo n.º 4
0
def student_login():
    if student_info['name']:
        print('已经登录')
        return
    print('学生登录')
    while True:
        name=input('请输入名字:').strip()
        if name == 'q': break
        password=input("请输入密码").strip()
        flag,msg=common_interface.login(name,password,'student')
        if flag:
            print(msg)
            student_info['name']=name
            break
        else:
            print(msg)
Exemplo n.º 5
0
def teacher_login():
    if teacher_info['name']:
        print('已经登录')
        return
    print('老师登录')
    while True:
        name = input('请输入名字:').strip()
        if name == 'q': break
        password = input("请输入密码").strip()
        flag, msg = common_interface.login(name, password, 'teacher')
        if flag:
            print(msg)
            teacher_info['name'] = name
            break
        else:
            print(msg)
Exemplo n.º 6
0
def dispatch(head_dic, conn):
    if head_dic['type'] == 'login':  # 登录
        back_dic = common_interface.login(head_dic, mutex)
        send_back(back_dic, conn)
    elif head_dic['type'] == 'download_movie':  # 下载
        back_dic = user_interface.download_movie(head_dic)
        send_back(back_dic, conn)
        with open(back_dic['path'], 'rb')as f:
            for line in f:
                conn.send(line)

    elif head_dic['type'] == 'upload':  # 上传
        back_dic = admin_interface.upload_movie(head_dic, conn)
        send_back(back_dic, conn)
    else:
        if head_dic['type'] not in dispatch_dic:
            back_dic = {'flag': False, 'msg': '请求不存在'}
            send_back(back_dic, conn)
        else:
            back_dic = dispatch_dic[head_dic['type']](head_dic)
            send_back(back_dic, conn)