コード例 #1
0
def check_bal():
    db=shelve.open('database/bank.db',writeback=True)
    acc=input("enter account number: ")
    CB=db[acc]['bal']
    update_log("INFO",f"Checking for balance")
    print("\n\tYour account balance is :",CB)
    db.close()
コード例 #2
0
def credit():
    db=shelve.open('database/bank.db',writeback=True)
    acc=input("enter account number: ")
    CB = db[acc]['bal']
    amt=int(input("\n\tEnter amount which you want to deposit: "))
    print("Your Previous Balance is",CB)
    NB=CB+amt
    db[acc]['bal']=NB
    print("\n\tYour Updated balance is",NB)
    update_log("INFO",f"Amount Deposit Successful")
    db.close()
コード例 #3
0
def update_pwd():
    db=shelve.open('database/bank.db',writeback=True)
    acc=input("enter account number: ")
    p1=getpass("enter new password :"******"re-type password :"******"INFO","Password Update")
        print("\n")
        print(f"Password updated successfully for account number {acc}")
    else:
        update_log("ERROR","Invalid Input")
        print("\n\tplease enter valid input")
        update_pwd()
    db.close()
            
コード例 #4
0
def debit():
    print("\n\t")
    db=shelve.open('database/bank.db',writeback=True)
    acc=input("enter account number: ")
    curr_bal = db[acc]['bal']
    amt=int(input("Enter amount which you want to withdrawl: "))
    if amt > curr_bal:
        update_log("ERROR",f"Deny for withdrwal for acc no {acc}")
        print("\nInsufficient Balance")
    else:
        print("\n\tYour Previous Balance is",curr_bal)
        new_bal=curr_bal-amt
        db[acc]['bal']=new_bal
        print("\n\tYour Updated balance is",new_bal) 
        update_log("INFO",f"Withdrawl Successful")
    db.close()
コード例 #5
0
ファイル: auth.py プロジェクト: ranvijaysanu/python
def signup():
    os.system("cls")
    print("\n\n\t\tWelcome to Signup Service\n\n")
    print(f"Time : {time.ctime()}")
    name = input("\n\n\tEnter your name : ")
    bal = eval(input("\n\tEnter your initial amount : "))
    password = getpass.getpass("\n\tPassword :"******"SIGNUP",f"Signup sucessfull for acc no {acc_no} because of Password Verification")
    print("\n\n\tAccount Create Sucessfully Write down your account number ")
    print(f"\n\n\t your account num is {acc_no} and used to login \n\n")
    input("\n\n...........Press any key to continue....")
コード例 #6
0
ファイル: bank_app.py プロジェクト: ranvijaysanu/python
def main_menu():
    
    update_log("InFO","Application Started") 
    os.system("cls")
    print("\n\n")
    print(f"\n\t\t {time.ctime()} Welcome User ")
    s = """
        1. Login
        2. Signup
        3. Exit
    """
    print(s)
    while True :
        try : 
            print('\n')
            ch = int(input("Enter your choice : ".rjust(30)))
            if ch < 1 or ch > 3 : 
                print("\n\n\t\tError!!! Invalid Choice")
                continue
            break
        except ValueError as e : 
            print("\n\n\t\tError!!!Bhaai saab integer choice string mtt do")

    if ch == 1 :
        update_log("INFO","User Tried To Login")
        login()
        main_menu()
    elif ch == 2 : 
        update_log("INFO","User Tried To Signup")
        signup()
        main_menu()
コード例 #7
0
ファイル: auth.py プロジェクト: ranvijaysanu/python
def login():
    acc = input("\n\n\t\tEnter account number : ")
    db = shelve.open("database/bank.db")
    if acc in db.keys() : 
        password = getpass.getpass("\n\t\tPassword : "******"LOGIN",f"Login sucessfull for acc no {acc}")
            sub_menu(acc)
        else : 
            update_log("ERROR",f"Login unsucessfull for acc no {acc} because of Password Verification")
            print("\n\n\t\tError!! Invalid Password....Try Agai")
                
    else : 
        update_log("DENY","unauthoriged account accessed")
        print("\n\n\t\tError!!! Invalid Account Number")
        print("\n\n\t\tIf you are a new user please SignUp First")
    
    print("\n\n\t\t.......redirecting to main menu........")
    time.sleep(4)
コード例 #8
0
ファイル: bank_app.py プロジェクト: ranvijaysanu/python
            ch = int(input("Enter your choice : ".rjust(30)))
            if ch < 1 or ch > 3 : 
                print("\n\n\t\tError!!! Invalid Choice")
                continue
            break
        except ValueError as e : 
            print("\n\n\t\tError!!!Bhaai saab integer choice string mtt do")

    if ch == 1 :
        update_log("INFO","User Tried To Login")
        login()
        main_menu()
    elif ch == 2 : 
        update_log("INFO","User Tried To Signup")
        signup()
        main_menu()



if __name__ == "__main__" : 
    
    main_menu()
    os.system('cls')
    print("\n\n\n")
    print("\t\t\tThanks for using Our Services")
    print("\n\n\t\t..................Exiting.............")
    update_log("INFO","Application Closed")
    time.sleep(random.randint(2,5))
    os.system('cls')