Exemple #1
0
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)
Exemple #2
0
def index():

    if security.verify_request():

        return dashboard.renderDashboard(session.get('hash'))

    else:
        session.pop('hash', None)
        return redirect("/login", code=302)    
Exemple #3
0
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)
Exemple #4
0
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)        
Exemple #5
0
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)        
Exemple #6
0
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!"
Exemple #7
0
def profile_page():
    if security.verify_request():

        return profilepage.renderProfile(session.get('hash'))
    else:
        return redirect("/", code=302)
Exemple #8
0
def register():
    if security.verify_request():
        return redirect("/", code=302)
    else:
        return render_template('register_form.html', error="TestError")
Exemple #9
0
def login():
    if security.verify_request():
        return redirect("/", code=302)
    else:
        return render_template('login_form.html')
Exemple #10
0
def logout():
    if security.verify_request():
        session.pop('hash', None)
        return redirect("/", code=302)
    else:
        return redirect("/", code=302)