Ejemplo n.º 1
0
    def ui_login(self):
        program_is_running = True
        print("====== Employee Login ======\n")
        username = input("Username: "******"-Password input is hidden-")
        password = getpass.getpass()  # built-in Python module
        print("")
        # creates current_employee class using username and password
        # login() method checks if it's a valid employee and returns
        # true if employee found in data file and given password matches.
        # Next method checks for employee
        # admin status and sets it according to data file.
        current_employee = Employee(username, password)

        if self.__employee_services.login(current_employee, password):
            current_employee.manager = current_employee.is_manager()
            # Must pass current_employee class to main menu to
            # carry employee data to method and rest of program

            while program_is_running == True:
                self.main_menu(current_employee)

        else:
            print("Invalid username or password\n")
            self.ui_login()