Update calculate.py
Browse files- calculate.py +5 -4
calculate.py
CHANGED
@@ -8,8 +8,8 @@ app = Flask(__name__)
|
|
8 |
app.secret_key = "secret_key_aman_diganti"
|
9 |
|
10 |
# Data login hardcoded
|
11 |
-
VALID_USER = os.getenv("VALID_USER")
|
12 |
-
VALID_PASS = os.getenv("VALID_PASS")
|
13 |
|
14 |
# Middleware: Cek login sebelum semua request (kecuali /login dan /static file)
|
15 |
@app.before_request
|
@@ -21,8 +21,9 @@ def require_login():
|
|
21 |
@app.route("/login", methods=["GET", "POST"])
|
22 |
def login():
|
23 |
if request.method == "POST":
|
24 |
-
user = request.form.get("username")
|
25 |
-
password = request.form.get("password")
|
|
|
26 |
if user == VALID_USER and password == VALID_PASS:
|
27 |
session["user"] = user
|
28 |
return redirect(url_for("home"))
|
|
|
8 |
app.secret_key = "secret_key_aman_diganti"
|
9 |
|
10 |
# Data login hardcoded
|
11 |
+
VALID_USER = str(os.getenv("VALID_USER"))
|
12 |
+
VALID_PASS = str(os.getenv("VALID_PASS"))
|
13 |
|
14 |
# Middleware: Cek login sebelum semua request (kecuali /login dan /static file)
|
15 |
@app.before_request
|
|
|
21 |
@app.route("/login", methods=["GET", "POST"])
|
22 |
def login():
|
23 |
if request.method == "POST":
|
24 |
+
user = str(request.form.get("username"))
|
25 |
+
password = str(request.form.get("password"))
|
26 |
+
print(user, VALID_USER, password, VALID_PASS)
|
27 |
if user == VALID_USER and password == VALID_PASS:
|
28 |
session["user"] = user
|
29 |
return redirect(url_for("home"))
|