Exemplo n.º 1
0
def user_valid(username,password):
    query = LanCloudUsers.all()
    query.order("-uid")
    query.filter("username ="******"password =",password)
    for user in query.run(limit=1):
        return user.uid
Exemplo n.º 2
0
def new_uid():
    query = LanCloudUsers.all()
    query.order("-uid")
    get = 0
    for last_uid in query.run(limit=1):
        get = last_uid.uid
    if get == 0:
        new_uid = 1
    else:
        new_uid = get + 1
    return new_uid
Exemplo n.º 3
0
</form>
"""

elif method == 'POST':
    formdata = cgi.FieldStorage()
    username = formdata.getvalue('username')
    password = formdata.getvalue('password')
    reenter = formdata.getvalue('reenter')
    

    if reenter != password:
        print 'Status: 302 Temporarily moved'
        print 'Location: /register?pwdsame=true'

    present = False
    query = LanCloudUsers.all()
    for user in query.run():
        if user.username == username:
            present = True

    if reenter == password:
        if present == True :
            print 'Status: 302 Temporarily moved'
            print 'Location: /register?exists=true'

    if reenter == password and present == False:
        insert = LanCloudUsers()
        insert.uid = new_uid()
        insert.username = username
        insert.password = password
        insert.put()