Пример #1
0
def CreateAccount():
    console.out(16, 0.03)

    askCommand = True
    while (askCommand):
        newUser = input("")
        newPass = ""
        if (not ParseForCommand(newUser)):
            askCommand = False

    doesMatch = False
    while (not doesMatch):
        console.out(21)
        newPass = getpass.getpass("")
        if (not ParseForCommand(newPass)
            ):  #Only run rest of routine if input was not a command
            console.out(22)
            check = getpass.getpass("")

            if (newPass == check):
                doesMatch = True
            else:
                console.out(23)

    newSalt = Encryptor.GenerateSALT()
    encPass = Encryptor.OneWayEncryptor(newPass, newSalt)
    FileHandler.CreateUserAccount(newUser, encPass, newSalt)
Пример #2
0
#First check if user account exists
fileFound = FileHandler.DoesAccountExist()
if (not fileFound):
    #Create user account since it doesn't exist
    try:
        CreateAccount()
        console.out(17)  #Success, account created
    except Exception:
        console.out(18)  #Failure
        raise

#Now get the user to log in to their account
credentialPass = False

validationKey = Encryptor.GenerateSALT()
while (not credentialPass):
    verification = VerifyUser()
    if (not verification[0]):
        if (verification[1] == "Invalid"):
            #console.cls()
            console.out(24, 0.03)
    else:
        #Success, user has logged in
        securityKey = Encryptor.GenerateSecurityKey()
        FileHandler.CreateSecurityFile(
            Encryptor.OneWayEncryptor(securityKey, validationKey), username)
        Command = CMD.CommandHandler(username, verification[1])
        credentialPass = verification

PasswordLocker()