MCPcopy Index your code
hub / github.com/geekcomputers/Python / on_login_button_clicked

Function on_login_button_clicked

bank_managment_system/QTFrontend.py:378–399  ·  view source on GitHub ↗
(parent, name_field, password_field)

Source from the content-addressed store, hash-verified

376
377
378def on_login_button_clicked(parent, name_field, password_field):
379 name = name_field.text().strip()
380 password = password_field.text().strip()
381
382 if not name or not password:
383 show_popup_message(parent, "Please enter your name and password.", HOME_PAGE)
384 else:
385 try:
386 # Ideally, here you'd call a backend authentication check
387 success = backend.check_admin(name, password)
388 if success:
389 QtWidgets.QMessageBox.information(
390 parent, "Login Successful", f"Welcome, {name}!"
391 )
392 else:
393 QtWidgets.QMessageBox.warning(
394 parent, "Login Failed", "Incorrect name or password."
395 )
396 except Exception as e:
397 QtWidgets.QMessageBox.critical(
398 parent, "Error", f"An error occurred during login: {str(e)}"
399 )
400
401
402def create_home_page(parent, on_admin_clicked, on_employee_clicked, on_exit_clicked):

Callers

nothing calls this directly

Calls 3

show_popup_messageFunction · 0.85
check_adminMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected