def register_request(): if security.verify_request(): return redirect("/", code=302) else: if request.method == "POST": user = request.form["username"] password = request.form["password"] email = request.form["email"] if user != "" and password != "" and email != "": insert = database.insert_new_user(user, email, password) if insert is True: return redirect("/login", code=302) else: return redirect("/register", code=302) else: return redirect("/register", code=302) else: return redirect("/register", code=302)
def index(): if security.verify_request(): return dashboard.renderDashboard(session.get('hash')) else: session.pop('hash', None) return redirect("/login", code=302)
def call_projects_page_valid(id): if security.verify_request(): validate = database.validateProject(id) if validate is True: return projects.renderProjects(session.get('hash'), validate, id) else: return redirect("/", code=302) else: return redirect("/", code=302)
def create_project(): if security.verify_request(): if request.method == "POST": title = request.form["project_title"] description = request.form["project_description"] if title != "" and description != "": database.createNewProject(title, description) return redirect("/", code=302) else: return redirect("/", code=302) else: return redirect("/", code=302) else: return redirect("/", code=302)
def add_card(): if security.verify_request(): if request.method == "POST": title = request.form["card_title"] description = request.form["card_description"] if title != "" and description != "": getId = str(request.referrer).split("/") database.createProjectCards(int(getId[4]), title, description) return redirect("/projects/" + getId[4], code=302) else: return redirect("/", code=302) else: return redirect("/", code=302) else: return redirect("/", code=302)
def login_request(): if security.verify_request(): return redirect("/", code=302) else: if request.method == "POST": user = request.form["username"] password = request.form["password"] if user != "" and password != "": verifyUser = database.verifyUsername(user) if verifyUser is False: return redirect("/register", code=302) else: verifyPassword = database.get_registered_user(user, password) if not verifyPassword: return "Wrong Password" else: session['hash'] = verifyPassword[0][3] return redirect("/", code=302) else: return "login failed, not every field was filled!"
def profile_page(): if security.verify_request(): return profilepage.renderProfile(session.get('hash')) else: return redirect("/", code=302)
def register(): if security.verify_request(): return redirect("/", code=302) else: return render_template('register_form.html', error="TestError")
def login(): if security.verify_request(): return redirect("/", code=302) else: return render_template('login_form.html')
def logout(): if security.verify_request(): session.pop('hash', None) return redirect("/", code=302) else: return redirect("/", code=302)