Esempio n. 1
0
def logout():
    # if user is not logged in, show him an error message saying he can't access this page.
    if (not isUserLoggedIn()):
        return abort(403)

    session.clear()
    flash("You have successfully logged out", "success")
    return sendUserToHome()
Esempio n. 2
0
def write_delete(postid):
    # if the user is not logged in, disallow from accessing this link.
    if (not isUserLoggedIn()):
        return abort(403)

    deletePost(postid)

    flash("You have successfully deleted the content", "success")
    return sendUserToHome()
Esempio n. 3
0
def news_edit(postid):
    # if the user is not signed in and logged in, disallow from accessing this link.
    if (not isUserLoggedIn()):
        return abort(403)

    result = editPost(postid)
    return render_template("news_edit.html",
                           post_data=result,
                           admins=retrieveAdmins())
Esempio n. 4
0
def edit_success(postid):
    # if the user is not logged in, disallow from accessing this link.
    if (not isUserLoggedIn()):
        return abort(403)

    title = request.form.get('news_title')
    content = request.form.get('news_message')

    updatePost(title, content, postid)

    flash("You have successfully edited the content", "success")
    return sendUserToHome()
Esempio n. 5
0
def write_success():
    # if the user is not logged in, disallow from accessing this link.
    if (not isUserLoggedIn()):
        return abort(403)

    title = request.form.get('news_title')
    content = request.form.get('news_message')
    author = session.get("accountid")

    writePost(title, content, author)

    flash("You have successfully posted the content", "success")
    return sendUserToHome()
Esempio n. 6
0
def dashboard(accountid):
    # if user is not logged in, show him an error message saying he can't access this page.
    if (not isUserLoggedIn()):
        return abort(403)

    # if the session accountid is not the same as accountid passed to dashboard param then don't allow this process.
    if (session.get('accountid') != accountid):
        return abort(403)

    result_account, result_skill, result_item = retrieveUserData(accountid)

    return render_template("dashboard.html",
                           active='dashboard',
                           account=result_account,
                           skill=result_skill,
                           item=result_item,
                           admins=retrieveAdmins())
Esempio n. 7
0
def news_write():
    # if the user is not signed in and logged in, disallow from accessing this link.
    if (not isUserLoggedIn()):
        return abort(403)

    return render_template("news_write.html", admins=retrieveAdmins())