예제 #1
0
def folio(username="",page=""):
    if not username and "user" not in session:
        return redirect(url_for("login"))

    #if "user" in session and not username: #cannot access other pages when logged in
     #   username = session["user"]
    if not page:
        if 'user' in session and session['user'] == username:
            return redirect(url_for("home",username))
        else: #'user' in session and session['user'] != username:
            page = 'about' #page doesn't exist but the person accessing it is not the owner of the page


    
    folio = db.getPage(username,page)
    projects = db.getProjects(username)
    
    if folio == "folio or project does not exist":
        return redirect(url_for("home"))
    
    return render_template("user.html",username=username
                               ,page=page,folio=folio,projects=projects)
예제 #2
0
def getProjects():
    username = request.args.get("username","")
    if not username:
        username = session['user']

    return json.dumps(db.getProjects(username))