nagasurendra commited on
Commit
0c44a73
·
verified ·
1 Parent(s): 71f182f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -284,6 +284,23 @@ button {
284
  alert("Your final order has been submitted!");
285
  }
286
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  # Modal HTML Content
288
  MODAL_HTML = """
289
  <div id="modal" style="display: none; position: fixed; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
 
284
  alert("Your final order has been submitted!");
285
  }
286
  </script>
287
+ def authenticate_user(email, password):
288
+ if check_credentials(email, password):
289
+ return gr.update(visible=False), gr.update(visible=True), ""
290
+ else:
291
+ return gr.update(visible=True), gr.update(visible=False), "Invalid email or password. Try again."
292
+
293
+ def navigate_to_signup():
294
+ return gr.update(visible=False), gr.update(visible=True)
295
+
296
+ def create_account(name, phone, email, password):
297
+ if save_user(name, phone, email, password):
298
+ return "Account created successfully! You can now log in.", gr.update(visible=True), gr.update(visible=False)
299
+ else:
300
+ return "Email already exists. Try logging in.", gr.update(visible=False), gr.update(visible=True)
301
+
302
+ def navigate_to_login():
303
+ return gr.update(visible=True), gr.update(visible=False)
304
  # Modal HTML Content
305
  MODAL_HTML = """
306
  <div id="modal" style="display: none; position: fixed; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">