Spaces:
Running
Running
David Ko
commited on
Commit
ยท
913f3b4
1
Parent(s):
a44b826
Update api.py
Browse files
api.py
CHANGED
@@ -1150,11 +1150,11 @@ def login():
|
|
1150 |
|
1151 |
# ๋ฆฌ๋๋ ์
์ฒ๋ฆฌ
|
1152 |
next_page = request.args.get('next')
|
1153 |
-
if next_page and next_page.startswith('/'):
|
1154 |
print(f"Redirecting to: {next_page}")
|
1155 |
return redirect(next_page)
|
1156 |
-
print("Redirecting to
|
1157 |
-
return redirect('/
|
1158 |
else:
|
1159 |
error = 'Invalid username or password'
|
1160 |
print(f"Login failed: {error}")
|
@@ -1209,19 +1209,17 @@ def status():
|
|
1209 |
})
|
1210 |
|
1211 |
@app.route('/')
|
|
|
1212 |
def index():
|
1213 |
print(f"Root route accessed, user authenticated: {current_user.is_authenticated}")
|
1214 |
-
|
1215 |
-
print(f"User is authenticated as: {current_user.id}")
|
1216 |
-
return redirect('/index')
|
1217 |
-
else:
|
1218 |
-
print("User is not authenticated, redirecting to login")
|
1219 |
-
return redirect(url_for('login'))
|
1220 |
|
1221 |
@app.route('/index')
|
1222 |
@login_required
|
1223 |
def index_page():
|
1224 |
-
|
|
|
|
|
1225 |
|
1226 |
if __name__ == "__main__":
|
1227 |
# ํ๊น
ํ์ด์ค Space์์๋ PORT ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํฉ๋๋ค
|
|
|
1150 |
|
1151 |
# ๋ฆฌ๋๋ ์
์ฒ๋ฆฌ
|
1152 |
next_page = request.args.get('next')
|
1153 |
+
if next_page and next_page.startswith('/') and next_page != '/login':
|
1154 |
print(f"Redirecting to: {next_page}")
|
1155 |
return redirect(next_page)
|
1156 |
+
print("Redirecting to root page")
|
1157 |
+
return redirect('/')
|
1158 |
else:
|
1159 |
error = 'Invalid username or password'
|
1160 |
print(f"Login failed: {error}")
|
|
|
1209 |
})
|
1210 |
|
1211 |
@app.route('/')
|
1212 |
+
@login_required
|
1213 |
def index():
|
1214 |
print(f"Root route accessed, user authenticated: {current_user.is_authenticated}")
|
1215 |
+
return send_from_directory('static', 'index.html')
|
|
|
|
|
|
|
|
|
|
|
1216 |
|
1217 |
@app.route('/index')
|
1218 |
@login_required
|
1219 |
def index_page():
|
1220 |
+
# /index ๊ฒฝ๋ก๋ ๋ฃจํธ ๊ฒฝ๋ก์ ๋์ผํ๊ฒ ์ฒ๋ฆฌ
|
1221 |
+
print("Index route redirecting to root")
|
1222 |
+
return redirect('/')
|
1223 |
|
1224 |
if __name__ == "__main__":
|
1225 |
# ํ๊น
ํ์ด์ค Space์์๋ PORT ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํฉ๋๋ค
|