@@ -19,6 +19,14 @@ def inject_globals():
1919 }
2020
2121@main .route ('/' )
22+ def home ():
23+ # Public landing page (keep product or marketing content)
24+ # If you prefer the root to redirect to dashboard for logged-in users,
25+ # we can change this to detect session and redirect.
26+ return render_template ('product.html' )
27+
28+
29+ @main .route ('/dashboard' )
2230def dashboard ():
2331 # require login to view dashboard
2432 user_id = session .get ('user_id' )
@@ -53,16 +61,23 @@ def signup():
5361 if request .method == 'POST' :
5462 email = request .form .get ('email' )
5563 password = request .form .get ('password' )
64+ confirm = request .form .get ('confirm_password' )
5665 if not email or not password :
5766 flash ('Email and password are required.' , 'error' )
58- return render_template ('signup.html' )
67+ return render_template ('signup.html' , email = email )
68+ if confirm is None :
69+ # older forms may not include confirm field
70+ confirm = ''
71+ if password != confirm :
72+ flash ('Passwords do not match. Please confirm your password.' , 'error' )
73+ return render_template ('signup.html' , email = email )
5974 success = create_user (email , password )
6075 if success :
6176 flash ('Account created. Please log in.' , 'success' )
6277 return redirect (url_for ('main.login' ))
6378 else :
6479 flash ('Email already exists.' , 'error' )
65- return render_template ('signup.html' )
80+ return render_template ('signup.html' , email = email )
6681 return render_template ('signup.html' )
6782
6883
@@ -247,6 +262,77 @@ def complete_profile():
247262 return render_template ('complete_profile.html' )
248263
249264
265+ def _require_login ():
266+ user_id = session .get ('user_id' )
267+ if not user_id :
268+ flash ('Please log in to access this page.' , 'error' )
269+ return False
270+ return True
271+
272+
273+ @main .route ('/dashboard/general' )
274+ def dashboard_general ():
275+ if not _require_login ():
276+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_general' )))
277+ return render_template ('dashboard_general.html' )
278+
279+
280+ @main .route ('/dashboard/account' )
281+ def dashboard_account ():
282+ if not _require_login ():
283+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_account' )))
284+ return render_template ('dashboard_account.html' )
285+
286+
287+ @main .route ('/dashboard/notifications' )
288+ def dashboard_notifications ():
289+ if not _require_login ():
290+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_notifications' )))
291+ return render_template ('dashboard_notifications.html' )
292+
293+
294+ @main .route ('/dashboard/api' )
295+ def dashboard_api ():
296+ if not _require_login ():
297+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_api' )))
298+ return render_template ('dashboard_api.html' )
299+
300+
301+ @main .route ('/dashboard/imports' )
302+ def dashboard_imports ():
303+ if not _require_login ():
304+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_imports' )))
305+ return render_template ('dashboard_imports.html' )
306+
307+
308+ @main .route ('/dashboard/group' )
309+ def dashboard_group ():
310+ if not _require_login ():
311+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_group' )))
312+ return render_template ('dashboard_group.html' )
313+
314+
315+ @main .route ('/dashboard/project' )
316+ def dashboard_project ():
317+ if not _require_login ():
318+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_project' )))
319+ return render_template ('dashboard_project.html' )
320+
321+
322+ @main .route ('/dashboard/environment' )
323+ def dashboard_environment ():
324+ if not _require_login ():
325+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_environment' )))
326+ return render_template ('dashboard_environment.html' )
327+
328+
329+ @main .route ('/dashboard/security' )
330+ def dashboard_security ():
331+ if not _require_login ():
332+ return redirect (url_for ('main.login' , next = url_for ('main.dashboard_security' )))
333+ return render_template ('dashboard_security.html' )
334+
335+
250336@main .route ('/api/chat' , methods = ['POST' ])
251337def api_chat ():
252338 data = request .get_json () or {}
0 commit comments