Beispiel #1
0
def newUserPage():
    accountList = []
    a = Iterator.Iterator
    a = ada.AccessDatabaseAccounts().getIterator()
    while a.hasNext():
        accountList.append(a.next())
    return render_template('newUser.html', accountList=accountList)
Beispiel #2
0
def addNewUser():
    newUserInfo = ""
    temp = request.get_json(force=True)
    for i in temp:
        newUserInfo += str(i['message'])
    a = Iterator.Iterator
    a = ada.AccessDatabaseAccounts().getIterator()
    a.add(newUserInfo)
Beispiel #3
0
def startupPage():
    #fetch.Fetch()
    accountList = []
    a = Iterator.Iterator
    a = ada.AccessDatabaseAccounts().getIterator()
    while a.hasNext():
        accountList.append(a.next())
    print(accountList)
    return render_template('signInPage.html', accountList=accountList)
Beispiel #4
0
def accountsPage():
    currentUser = Statics.currentUser
    currentUserType = Statics.currentUserType
    accountList = []
    a = Iterator.Iterator
    a = ada.AccessDatabaseAccounts().getIterator()
    while a.hasNext():
        accountList.append(a.next())
    print(accountList)
    return render_template('accounts.html',
                           currentUser=currentUser,
                           currentUserType=currentUserType,
                           accountList=accountList)
Beispiel #5
0
def update():
    Statics.currentUser = ""
    currentUser = request.get_json(force=True)
    loginInfo = ""
    for i in currentUser:
        loginInfo += str(i['userpass'])
    receivedData = loginInfo.split("#")
    username = receivedData[0]
    password = receivedData[1]
    userList = []
    a = Iterator.Iterator
    a = ada.AccessDatabaseAccounts().getIterator()
    while a.hasNext():
        userList.append(a.next())

    isUsernameValid = False

    r0 = InitialState.InitialState()
    r1 = OKState.OKState()
    r2 = WrongPasswordState.WrongPasswordState()
    r3 = WrongUsernameState.WrongUsernameState()

    rc = ResponseContext.ResponseContext(r0)
    rc.respondToState("", "")

    #id, username, password, fullname, usertype

    for i in userList:
        eachUserInfo = i.split("#")
        userType = eachUserInfo[4]
        if eachUserInfo[1] == username and eachUserInfo[2] == password:
            rc.setState(r1)
            rc.respondToState(username, userType)
            isUsernameValid = True
            break
        if eachUserInfo[1] == username and eachUserInfo[2] != password:
            rc.setState(r2)
            rc.respondToState(username, userType)
            isUsernameValid = True
            break

    if isUsernameValid == False:
        rc.setState(r3)
        rc.respondToState(username, "")

    response = Statics.authMessage
    print(response)
    return render_template('signInPage.html', response=response)