Exemplo n.º 1
0
def main():
    pass_word = password2
    print("Hello, What name would like use to call you?")
    master_name = input()
    print("Please enter your master password :"******"Hello {master_name}. what would you like to do?")
    print('\n')

    while True:
        print("Use these short codes :")
        print(" cc - create a new account")
        print(" dc - display accounts")
        print(" fc -find a account")
        print(" ex -exit the account list")
        short_code = input().lower()

        if short_code == 'cc':
            #account
            print("New account")
            print("-" * 10)

            #account_name
            print(
                "Please type in the account:(Facebook, Twitter, Gmail e.t.c)")
            a_name = input()

            #user_name
            print("Username:"******"Do you what us to generate a password for you ....(yes or no)"
            )
            shortcode = input()
            if shortcode == 'yes':
                password = pass_word
                print(f"your password is {password} ")
            else:
                print("enter your password")
                password = input()
            #Saves the credentials
            save_accounts(create_account(a_name, u_name, password))

            print('\n')
            print(
                f"you have succesfully created your new credentials for {a_name} account"
            )
            print('\n')

        elif short_code == 'dc':

            if Account.display_account():
                print("Here is a list of all your accounts")
                print('\n')

                for account in Account.display_account():
                    print("Account          Username          Password")
                    print(
                        f"{account.account_name}            {account.username}         {account.password}"
                    )

                print('\n')
            else:
                print('\n')
                print("You dont seem to have any accounts saved yet")
                print('\n')

        elif short_code == 'fc':

            print("Enter the account you want to search for")

            search_account = input()
            if check_existing_accounts(search_account):
                search_account = find_account(search_account)
                print(f"{Account.search_account.account_name}")
                print('-' * 20)

                print(f"Username: .......{search_account.user_name}")
                print(f"Password: .......{search_account.password}")
            else:
                print("That account does not exist")

        elif short_code == "ex":
            print("Bye .......")
            break
        else:
            print("Invalid Input! ")
Exemplo n.º 2
0
    def test_display_all_account(self):
        '''
        method that returns a list of all contacts saved
        '''

        self.assertEqual(Account.display_account(), Account.accounts)