Beispiel #1
0
def login():

    x = datetime.datetime.now()

    accountNumberFromUser = input("\nWhat is your Account Number?\n")

    isValidAccountNumber = validation.accountNumberValidation(
        accountNumberFromUser)

    if not isValidAccountNumber:
        print("Invalid Account number")
        init()
    else:
        password = getpass("\nWhat is your password?\n")

        is_db_authenticated_user = database.authentication(
            accountNumberFromUser, password)
        print(is_db_authenticated_user)

        if is_db_authenticated_user:

            session_login = database.auth_sessionlogin(accountNumberFromUser)

            if session_login:
                print("**************Login successful*************** @ ", x)

                bankOperation(accountNumberFromUser, is_db_authenticated_user)
                init()

        else:
            print("authentication failed:")
            init()
Beispiel #2
0
def login():
    print("***** Login *****")
    # print(database)
    accountNumberFromUser = input("Please enter your account number? \n")

    isValidAccountNumber = validation.accountNumberValidation(
        accountNumberFromUser)
    if isValidAccountNumber:

        # passwordFromUser = input("Please enter your password \n")
        password = getpass("What is your password?\n")
        user = database.authenticatedUser(accountNumberFromUser, password)
        newAuth = database.createAuth(accountNumberFromUser, firstName,
                                      lastName, email, password, newBalance)
        if user:
            bankOperation(user)
        # for accountNumber,userDetails in database.items():
        #     if accountNumber == int(accountNumberFromUser):
        #         if userDetails[3] == passwordFromUser:
        #             bankOperation(userDetails)
        # print("Invalid account number or password. please try again")
        # login()
    else:
        print(
            "Account number Invalid: check that you have up to 10 digits and only integers"
        )
        init()
def login():  #Needs account number and password

    print("******** Login ********  \n")

    userAccountNumber = (input("What is your account number? \n"))

    isValidAccountNumber = validation.accountNumberValidation(
        userAccountNumber)

    if isValidAccountNumber:

        password = getpass("What is your password \n")

        user = database.authUser(userAccountNumber, password)

        if user:
            database.authCreate(user)
            bankOperation(user)

        print(
            "Invalid account number or password\n Remember! You must have a REGISTERED account"
        )
        login()

    else:
        print(
            "Account Number Invaild: check that you have 10 digits and only intergers"
        )
        init()
Beispiel #4
0
def read(userAccountNumber):

    isValidAccountNumber = validation.accountNumberValidation(
        userAccountNumber)
    try:

        if isValidAccountNumber:
            f = open(userDBPath + str(userAccountNumber) + ".txt", "r")

        else:
            f = open(userDBPath + userAccountNumber, "r")

    except FileNotFoundError:
        print("File Not Found")

    except FileExistsError:
        print("User does not exist")

    except TypeError:
        print("Invalid Account Number Format")

    else:
        return f.readline()

    return False
Beispiel #5
0
def login():

    print("********* Login to your account ***********")

    accountNumberFromUser = input("Enter your account number \n")

    isValidAccountNumber = validation.accountNumberValidation(
        accountNumberFromUser)

    if isValidAccountNumber:

        pin = getpass("Enter your PIN \n")

        user = database.authenticatedUser(accountNumberFromUser, pin)

        if user:
            bankOperations(user)

        # for accountNumber,user in database.items():
        #     if accountNumber == int(accountNumberFromUser):
        #         if(user[3] == pin):
        #             bankOperations(user)

        print('Invalid Account Number or PIN')
        login()
    else:

        print("Account Number must be 10 digits")
        init()
Beispiel #6
0
def read(userAccountNumber):
    isAccountNumberValid = validation.accountNumberValidation(userAccountNumber)
    try:
        if isAccountNumberValid:
            f = open(user_db_path + str(userAccountNumber) + '.txt', 'r')
        else:
            f = open(user_db_path + userAccountNumber, 'r')

    except FileNotFoundError:
        print('User not found')
    except FileExistsError:
        print('User doesnt exist')
    except TypeError:
        print('Invalid number format')
    else:
        return f.readline()

    return False
Beispiel #7
0
def login ():
    print('***** Please Login *****')

    accountNumberFromUser = input('Enter your Account Number \n')
    isValidAccountNumber = validation.accountNumberValidation(accountNumberFromUser)

    if  isValidAccountNumber:
        password = input('Enter your Pin \n')

        for accountNumber, userDetails in database.items():
            if accountNumber == int(accountNumberFromUser):
                if (userDetails[3] == password):
                    bankOperation(userDetails)
                            
        print('*** Invalid Account or Password! ***')
        login()
    else:
        login()
Beispiel #8
0
def read(acNumber):
    is_valid_account_number = validation.accountNumberValidation(acNumber)

    try:
        if (is_valid_account_number):

            f = open(user_database_path + str(acNumber) + ".txt", "r")

        else:
            f = open(user_database_path + acNumber, "r")

    except FileNotFoundError:
        print("file not found")

    except TypeError:
        print("Invalid account number format")

    else:
        return (f.readline())

    return False
Beispiel #9
0
def read(accountNumber):
    # find user with account number
    # fetch content of the file
    isValidAccountNumber = validation.accountNumberValidation(accountNumber)
    try:
        if isValidAccountNumber:
            f = open(userDbPath + str(accountNumber) + ".txt" , "r")
        else:
            f = open(userDbPath + accountNumber , "r")
    except FileNotFoundError:
        print("user not found")
        
    except FileExistsError:
        print("user doesn't exist")
    
    except TypeError:
        print("Invalid account number format")
        
    else:
        return f.readline()
    return False        
Beispiel #10
0
def login():
    global accountNumberFromUser
    loginPath = 'data/auth_session/'
    print('***Login into your account***')

    accountNumberFromUser = input('What is your account number \n')
    f = open(loginPath + str(accountNumberFromUser) + '.txt', 'x')

    isAccountValid = validation.accountNumberValidation(accountNumberFromUser)

    if isAccountValid:

        password = getpass('What is your password? \n')

        user = database.authenticatedUser(accountNumberFromUser, password)
        if user:
            bankOperation(user)

        login()

    else:
        print('Account Number Invalid, must be 10 integers ')
        init()