diff --git a/fileHost.py b/fileHost.py
index 32acfd6..782d3dd 100755
--- a/fileHost.py
+++ b/fileHost.py
@@ -170,6 +170,7 @@ def login_required(url=None):
username = request.form.get("user")
password = request.form.get("pass")
if verify_password(username, password):
+ session["username"] = username
return func(*args, **kwargs)
if url:
@@ -381,19 +382,20 @@ def upload():
file.save(os.path.join(fdir, fname))
url = app.config.get("UPLOAD_URL") + fname
urls.append(url)
- return "\n".join(urls)
+
+ if request.form.get("html"):
+ return render_template("result.html", urls=urls)
+ else:
+ return "\n".join(urls)
-@app.route("/", methods=["POST", "GET"])
+@app.route("/", methods=["GET"])
@login_required("login")
def index():
"""
Saves the uploaded file and returns a URL pointing to it.
"""
- if request.method == "GET":
- return render_template("index.html")
- urls = upload().split("\n")
- return render_template("result.html", urls=urls)
+ return render_template("index.html")
def get_rand_chars(n):
diff --git a/templates/index.html b/templates/index.html
index 1c1b467..377c592 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -9,7 +9,7 @@
Logout
Manage Uploads
Public Gallery
-