MCPcopy
hub / github.com/Sathvik-Rao/ClipCascade / on_login

Method on_login

ClipCascade_Desktop/src/gui/login.py:568–638  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

566 return False
567
568 def on_login(self):
569 # save data to config
570 self.config.data["username"] = self.username_entry.get()
571 self.config.data["password"] = self.password_entry.get()
572 self.config.data["server_url"] = LoginForm.remove_trailing_slash(
573 self.server_url_entry.get().strip()
574 )
575 self.config.data["cipher_enabled"] = self.cipher_var.get()
576 self.config.data["notification"] = self.notification_var.get()
577
578 # extra fields
579
580 # Validate hash_rounds
581 hash_rounds_input = self.hash_rounds_entry.get().strip()
582 if not LoginForm.is_positive_integer(hash_rounds_input):
583 CustomDialog(
584 "Invalid Input\nHash Rounds must be a positive integer.",
585 msg_type="error",
586 ).mainloop()
587 return # retry login
588 self.config.data["hash_rounds"] = int(hash_rounds_input)
589
590 self.config.data["salt"] = self.salt_entry.get()
591 self.config.data["save_password"] = self.save_password_var.get()
592
593 # Validate max_clipboard_size_local_limit_bytes
594 max_clipboard_size_local_limit_bytes_input = self.local_clipboard_size_entry.get().strip()
595 if max_clipboard_size_local_limit_bytes_input == "":
596 self.config.data["max_clipboard_size_local_limit_bytes"] = None
597 else:
598 if not LoginForm.is_positive_integer(max_clipboard_size_local_limit_bytes_input):
599 CustomDialog(
600 "Invalid Input\nMax Clipboard Size Local Limit must be a positive integer.",
601 msg_type="error",
602 ).mainloop()
603 return # retry login
604 self.config.data["max_clipboard_size_local_limit_bytes"] = int(
605 max_clipboard_size_local_limit_bytes_input
606 )
607
608 self.config.data["enable_image_sharing"] = self.enable_image_sharing_var.get()
609 self.config.data["enable_file_sharing"] = self.enable_file_sharing_var.get()
610
611 # Validate file download location
612 default_file_download_location = self.default_file_download_location_entry.get().strip()
613 if default_file_download_location == "":
614 self.config.data["default_file_download_location"] = ""
615 else:
616 if not os.path.exists(default_file_download_location):
617 CustomDialog(
618 "Invalid Input\nDefault File Download Location does not exist.",
619 msg_type="error",
620 ).mainloop()
621 return # retry login
622 self.config.data["default_file_download_location"] = default_file_download_location
623
624 ssl_ca_bundle = self.ssl_ca_bundle_entry.get().strip()
625 if ssl_ca_bundle:

Callers 1

__init__Method · 0.95

Calls 6

closeMethod · 0.95
CustomDialogClass · 0.90
getMethod · 0.80
remove_trailing_slashMethod · 0.45
is_positive_integerMethod · 0.45
mainloopMethod · 0.45

Tested by

no test coverage detected