Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Requested
#1
So I'm building a miniature code just to simulate a terminal like the command line, how ever it has a log on a phase which requires a password, which is 123 in the example below. I want the command Log off to send it back to the stage where it requires a password but I don't know how. If you could help it would be appreciated.

import time 
import sys


Input = 0
working = 1
Password = 0
Name = "User"
Goodbye = "Goodbye"
Change_Name = 0
Required_Password = "123"
B = "/:"
Change_Password = 0
stage = 0
while working == 1:
    if stage == 0:
        print("Greetings User")
        Password = input("Please enter passcode: ")
        if Password == Required_Password:
            print("Password excepted")
            stage = 1
        else:
            raise SystemExit("Password Check failed")

    C = Name + B

    if stage == 1:
        Input = input(C)

        if Input == "Admin":
            Change_Password = input("Change Password: ")
            if Change_Password == Required_Password:
                print("Sorry, ",Name,", This is the same password")
            else:
                Required_Password = Change_Password
                print("Password changed")               
        if Input == "Show password":
            print(Password)
        if Input == ("Help"):
            print("""
            Admin - Allows you to change the password
            Name - Allows you to change your Name
            Show password - Shows the password
            Help - Shows this screen
            Shut down - Shuts down the system""")
        if Input == ("Shut down"):
            raise SystemExit(Goodbye,Name) 
        if Input == ("Name"):
            Change_Name = input("Change Name: ")
            if Change_Name == Name:
                print("Sorry,",Name,",this is the same name.")
            else:
                Name = Change_Name
                print("Name Changed")
                C = Name + B
        if input == ("Log out"):
            stage = 0
Reply


Messages In This Thread
Help Requested - by Contraversia - Aug-01-2017, 07:00 PM
RE: Help Requested - by nilamo - Aug-01-2017, 07:34 PM
RE: Help Requested - by sparkz_alot - Aug-01-2017, 08:24 PM
RE: Help Requested - by Contraversia - Aug-23-2017, 02:50 PM
RE: Help Requested - by nilamo - Aug-23-2017, 02:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  The supplied user buffer is not valid for the requested operation. py2exe 1 3,361 Apr-27-2018, 12:17 AM
Last Post: py2exe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020