Exemplo n.º 1
0
def login(d):
    os.system('cls' if os.name == 'nt' else 'clear')
    user_name = input("Login\nEnter Full Name : ")
    entry = 0
    if (d == None):
        os.system('cls' if os.name == 'nt' else 'clear')
        print("Please create an account first!")
        return login_user()
    if user_name in d.keys():
        while int(entry) != 3:
            print("Entries left :", (3 - entry))
            pin = str(input("Enter 4-Digit Pin : "))

            if pin == d[user_name][0]:
                Net_balance = d[user_name][1]
                Pin = d[user_name][0]
                os.system('cls' if os.name == 'nt' else 'clear')
                return atm(user_name, Net_balance, Pin)

            else:
                entry += 1
                os.system('cls' if os.name == 'nt' else 'clear')
                print("Incorrect Pin!")
        os.system('cls' if os.name == 'nt' else 'clear')
        print("Login Unsuccessful\n")
        return login_user()

    else:
        os.system('cls' if os.name == 'nt' else 'clear')
        print("Invalid User!")
        return login_user()
Exemplo n.º 2
0
def login():
    global user_name
    user_name = input("Name : ")
    entry = 0
    if user_name in d.keys():
        while int(entry) != 3:
            pin = int(input("Enter 4-Digit Pin : "))
            if pin == d[user_name][0]:
                Net_balance = d[user_name][1]
                Pin = d[user_name][0]
                return atm(user_name, Net_balance, Pin)
            else:
                entry += 1
                print("Incorrect Pin")
        print("Login Unsuccessful")
        return login_user()
    else:
        print("Invalid User")
        return login_user()
Exemplo n.º 3
0
def login(d):
    clear = ('cls' if os.name == 'nt' else 'clear')
    os.system(clear)
    user_name = input("Login\nEnter Full Name : ")
    entry = 0
    if (d == None):
        os.system(clear)
        print("Please create an account first!")
        return new_account()

    for a in user_name:
        if ((ord(a) >= 65) and
            (ord(a) <= 90)) or ((ord(a) >= 97) and
                                (ord(a) <= 122)) or (ord(a) == 32):
            continue
        else:
            os.system(clear)
            print("Invalid User!")
            return login_user()

    acc_no = None
    for item in d.keys():
        if user_name.lower() in d[item]:
            acc_no = item
            break

        else:
            acc_no = None

    if acc_no == None:
        os.system(clear)
        print("Account not found/Invalid Name!")
        return login_user()

    elif acc_no.startswith('#'):
        os.system(clear)
        print("Account Is De-Activated!")
        return login_user()

    #--Admin Block--
    elif (user_name.lower() == 'admin access'):
        return admin_block(acc_no)
    #users block
    elif not (user_name.lower() == 'admin access'):
        user_name_l = user_name.lower()
        while int(entry) != 3:
            print("Entries left :", (3 - entry))
            pin = str(gp("Enter 4-Digit Pin : "))

            if pin == d[acc_no][1]:
                Pin = pin
                Net_balance = d[acc_no][2]
                History = d[acc_no][3]
                Mail_address = d[acc_no][4]
                Message = d[acc_no][5]
                os.system(clear)

                # Shows message at the top if there is any!
                if (Message == "None"):
                    (None)
                else:
                    print("Message: ", Message)

                return atm(user_name, Net_balance, Pin, History, acc_no,
                           Mail_address)

            else:
                entry += 1
                os.system(clear)
                print("Incorrect Pin!")
        os.system(clear)
        print("Login Unsuccessful\n")
        return login_user()

    else:
        os.system(clear)
        print("Invalid User!")
        return login_user()
Exemplo n.º 4
0
def login(d):
    import time, datetime
    os.system('cls' if os.name == 'nt' else 'clear')
    user_name = input("Login\nEnter Full Name : ")
    entry = 0
    if (d == None):
        os.system('cls' if os.name == 'nt' else 'clear')
        print("Please create an account first!")
        return login_user()

    #admin block
    elif (user_name in d.keys()) and (user_name.lower() == 'admin access'):
        pin = str(input("Enter 4-Digit Pin : "))

        if pin == d[user_name][0]:
            del d[user_name]
            os.system('cls' if os.name == 'nt' else 'clear')
            print(time.strftime('Date:%d-%b-%Y \nTime:%I:%M %p  Today:%A\n'))
            print(
                "Welcome to YOB Admin Block!\n\nSelect Option Provided Below")
            ad = input(
                "1.Active Users \n2.Active User Names\n3.Users Info.\n4.Remove User\n0.Exit\n"
            )
            while ad != '0':

                if ad == '1':
                    os.system('cls' if os.name == 'nt' else 'clear')
                    c_user = 0
                    for users in d:
                        c_user += 1
                    print("Active:")
                    print("Active Users :", c_user)

                elif ad == '2':
                    os.system('cls' if os.name == 'nt' else 'clear')
                    c_user = 0
                    print("Active User Names:")
                    for users in d:
                        c_user += 1
                        print("Active User", c_user, ':', users)

                elif ad == '3':
                    os.system('cls' if os.name == 'nt' else 'clear')
                    print("Users Info:")
                    for info in d.keys():
                        print("Name =", info, ", Pin :", d[info][0],
                              ", Amount :", "{:,}".format(d[info][1]))

                elif ad == '4':
                    os.system('cls' if os.name == 'nt' else 'clear')
                    return del_account()
                ad = input(
                    "1.Active Users \n2.Active User Names\n3.Users Info.\n4.Remove User\n0.Exit\n"
                )
            os.system('cls' if os.name == 'nt' else 'clear')
            return login_user()

        else:
            os.system('cls' if os.name == 'nt' else 'clear')
            return login_user()
    #users block
    elif user_name in d.keys():
        while int(entry) != 3:
            print("Entries left :", (3 - entry))
            pin = str(input("Enter 4-Digit Pin : "))

            if pin == d[user_name][0]:
                Pin = d[user_name][0]
                Net_balance = d[user_name][1]
                History = d[user_name][2]
                os.system('cls' if os.name == 'nt' else 'clear')
                return atm(user_name, Net_balance, Pin, History)

            else:
                entry += 1
                os.system('cls' if os.name == 'nt' else 'clear')
                print("Incorrect Pin!")
        os.system('cls' if os.name == 'nt' else 'clear')
        print("Login Unsuccessful\n")
        return login_user()

    else:
        os.system('cls' if os.name == 'nt' else 'clear')
        print("Invalid User!")
        return login_user()