Ejemplo n.º 1
0
    def Withdraw(self):
        clrscr()

        print_options(self.get_value("Username"), "Withdraw",
                      self.get_value("Address"), self.get_value("Balance"))
        print(
            "Enter the amount you want to withdraw. Press any letter to go back."
        )
        x = inpt("> ")

        if x.isdigit():
            x = int(x)
            if x <= 0:
                print(f"\033[91mYou can't withdraw ${x}\033[0m")
            elif x > int(self.get_value("Balance")):
                print("\033[91mInsufficient Funds.\033[0m")
            else:
                self.append_transaction(f"Withdrawed ${x}.")
                self.Account["Balance"] -= x
                return
        else:
            return

        self.update_account()
        inpt("Press \033[91menter\033[0m to continue")
Ejemplo n.º 2
0
    def Settings(self):
        while True:
            clrscr()

            self.options = {
                "Account Info": self.show_all_info,
                "Security": self.security,
                "Exit": "return"
            }
            print_options(self.get_value("Username"), "Settings",
                          self.get_value("Address"), self.get_value("Balance"),
                          self.options)
            if getKeyMenu(self.options) == "return":
                return True
        return False
Ejemplo n.º 3
0
    def Home(self):
        while True:
            clrscr()

            self.options = {
                "Deposit Money": self.Deposit,
                "Withdraw Money": self.Withdraw,
                "Settings": self.Settings,
                "Back": "return"
            }

            print_options(self.get_value("Username"), "Home",
                          self.get_value("Address"), self.get_value("Balance"),
                          self.options)
            if getKeyMenu(self.options) == "return":
                return True
        return False
Ejemplo n.º 4
0
    def security(self):
        while True:
            clrscr()

            self.options = {
                "Enable/Disable 2 Factor Authenthication": self.TFA,
                "Open Transaction Log": self.show_transaction,
                "Change Password": self.New_Password,
                "Change Phone Number": self.New_Phone,
                "Back": "return"
            }

            print_options(self.get_value("Username"), "Security",
                          self.get_value("Address"), self.get_value("Balance"),
                          self.options)

            if getKeyMenu(self.options) == "return":
                return True
        return False
Ejemplo n.º 5
0
    def New_Phone(self):
        print_options(self.get_value("Username"), "New Phone",
                      self.get_value("Address"), self.get_value("Balance"))

        while True:
            c = inpt("Your new phone number: ")

            if any(x.isdigit() for x in c) == True and len(c) == 10:
                self.Account["Phone"] = int(c)
                print("\033[92mPhone number changed!\033[0m")
                inpt("Press \033[91mEnter\033[0m to continue")
                break

            else:
                print(
                    "\033[91mInvaild phone number. Your number must have 10 digits.\033[0m"
                )

        self.update_account()
Ejemplo n.º 6
0
    def New_Password(self):
        print_options(self.get_value("Username"), "New Password",
                      self.get_value("Address"), self.get_value("Balance"))

        while True:
            x = inpt("Your new password: "******"Confirm new password: "******"Password"] = hashlib.blake2b(
                    x.encode()).hexdigest()
                print("\033[92mYou password changed!\033[0m")
                inpt("Press \033[91mEnter\033[0m to continue")
                break

            else:
                print(
                    "\033[91mYour confirmed password input doesn't match your new password! Please try again\033[0m"
                )

        self.update_account()
Ejemplo n.º 7
0
    def Deposit(self):
        clrscr()

        print_options(self.get_value("Username"), "Deposit",
                      self.get_value("Address"), self.get_value("Balance"))
        print(
            "Enter the amount you want to deposit. Enter any letter to go back."
        )

        x = inpt("> ")

        if x.isdigit():
            x = int(x)
            if x <= 0:
                print("\033[91mYou can't deposit $", x, "\033[0m")
            else:
                self.append_transaction(f"Deposited ${x}.")
                self.Account["Balance"] += x
                return
        else:
            return

        self.update_account()
        inpt("Press \033[91menter\033[0m to continue")
Ejemplo n.º 8
0
    def TFA(self):
        print_options(self.get_value("Username"), "Two Factor Authenthication",
                      self.get_value("Address"), self.get_value("Balance"))
        if self.Account["TFA"] == "True":
            self.Account["TFA"] = "False"
            print("\033[92m2FA Disabled.\033[0m")
            inpt("Press \033[91menter\033[0m to continue.")

        else:
            new_code = ""
            for _ in range(5):
                new_code += str(random.randint(0, 9))

            self.Account["TFA_Code"] = hashlib.blake2b(
                new_code.encode()).hexdigest()
            print(
                f"\033[92mTFA Enabled\033[0m, your code is \"\033[93m{new_code}\033[0m\""
            )

            inpt(
                "Press \033[91menter\033[0m when you've written down/remembered your TFA Code."
            )
            self.Account["TFA"] = "True"
        self.update_account()