Example #1
0
def validateStudent():
    username = getUsername()
    passhash=getPassHash()
    if control.isStudent(username) and control.validatePassword(username,passhash):
        print username + " validated"
        return username
    else:
        raise web.seeother('/logout/?msg=unauthorized')
Example #2
0
def validateUser():
    """
    Returns the username if the user cookies match the database. 
    Otherwise logs out the user.
    """
    username = getUsername()
    passhash=getPassHash()
    if control.validatePassword(username,passhash):
        return username
    else:
        raise web.seeother('/logout/?msg=unauthorized')
Example #3
0
def validateInstructor():
    """
    This method verifies that the user is an instructor 
    by testing the username/password pair. If it's good, return the
    username. Otherwise log the user out.
    """
    username = getUsername()
    passhash=getPassHash()
    if control.isInstructor(username) and control.validatePassword(username,passhash):
        print username + " validated"
        return username
    else:
        raise web.seeother('/logout/?msg=unauthorized')