def registered(): user_list = reader.make_dic(reader.read_file("data/users/user_auth.csv")) rf = request.form user = rf["txt_user"] pw = rf["txt_password"] pw2 = rf["txt_password2"] if user == "" or pw == "" or pw2 == "": return render_template("register.html",error = "ALL elements must be filled!",globe = globe) elif pw != pw2: return render_template("register.html",error = "Passwords must match",globe = globe) elif not checker.pwformat(pw): return render_template("register.html",error = "Passwords must contain characters AND numbers.",globe = globe) elif user in user_list.keys(): return render_template("register.html",error = "Username already exists.",globe = globe) else: reader.write_file("data/users/user_auth.csv",user + "," + pw + "," + "..static/img/default.png" + "\n") return redirect("/") return render_template("register.html",error = "",globe = globe)
def messages_send(): rf = request.form url = "data/users/messages.csv" # IMAGES ARE BLECH. reader.write_file(url,rf["user"] + "<,>" + session["username"] + "<,>" + rf["content"] + "<,>" + "False" + "<,>" + "/<end>\n")#+ rf["images"] + "," return redirect("/messages")
def post_content(): post_dir = "data/posts/posts.csv" rf = request.form reader.write_file(post_dir,rf["title"] + "<,>"+ session["username"] + "<,>" + str(rf["tags"].split(",")) + "<,>" + rf["content"] + "<,>" + rf["images"] + "," + "<,>" + "\<end>\n") return redirect("/post")