Skip to content

Conversation

@mgaffigan
Copy link
Contributor

  • Refactor to allow alternate implementations of LoginPanel
  • Moved handleLoginSuccess to Mirth client since it is actually setting up the process - not really doing anything with the panel
  • Make client command line testable

In support for future merge of mgaffigan:feature/add-oidc-auth

@tonygermano
Copy link
Member

@mgaffigan Is it possible to break this up into a few commits to make it easier to review? There is enough change that it's a bit difficult to mentally keep track of which changes are related to the same refactor and which aren't with all of the scrolling.

Copy link
Contributor Author

@mgaffigan mgaffigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible, yes, but it would result in ~4 PR's with 1 dependent upon the other three. I've added some comments in hopes those are sufficient to avoid splitting with dependencies. Vanilla git really sucks at stacked PR's.

@tonygermano
Copy link
Member

@mgaffigan I'm fine with them all being part of this single PR. I was just asking if the logical chunks can be separated into multiple commits.

@mgaffigan
Copy link
Contributor Author

Ah. Good call. Yes. I'll break to commits.

@mgaffigan mgaffigan force-pushed the maint/refactor-client-login branch from 4229704 to f9aad48 Compare September 3, 2025 14:56
@mgaffigan
Copy link
Contributor Author

@tonygermano, not sure each commit builds in isolation, but I rewrote the history by topic. Let me know if you need anything further.

@kpalang kpalang requested review from a team, gibson9583, kayyagari, kpalang and tonygermano and removed request for a team September 4, 2025 09:52
@mgaffigan mgaffigan force-pushed the maint/refactor-client-login branch 2 times, most recently from 4710eae to 37fe874 Compare October 15, 2025 12:04
jonbartels
jonbartels previously approved these changes Nov 4, 2025
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
…ying on global state

Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
…tations

Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
@mgaffigan mgaffigan force-pushed the maint/refactor-client-login branch from b258969 to e738ced Compare November 26, 2025 18:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the login system to support alternative login panel implementations in preparation for OIDC authentication. The refactoring extracts the handleLoginSuccess method from LoginPanel to the Mirth class (where it logically belongs since it performs application initialization) and introduces a factory pattern for obtaining LoginPanel instances.

Key changes:

  • Introduced AbstractLoginPanel base class and LoginPanelFactory for pluggable login implementations
  • Moved handleLoginSuccess logic from LoginPanel to Mirth.handleLoginSuccess() to separate login UI concerns from application setup
  • Updated all references from LoginPanel.getInstance() to LoginPanelFactory.getInstance()

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
AbstractLoginPanel.java New abstract base class defining the contract for login panel implementations with initialize() and setStatus() methods
LoginPanelFactory.java New factory class providing singleton access to login panel instances with support for runtime provider replacement
LoginPanel.java Refactored to extend AbstractLoginPanel; removed handleLoginSuccess() method (moved to Mirth), changed from singleton to factory-managed instance, added setError() helper method
Mirth.java Added public static handleLoginSuccess() method containing the application setup logic previously in LoginPanel; updated to use LoginPanelFactory
Frame.java Updated all references from LoginPanel.getInstance() to LoginPanelFactory.getInstance()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
});
}

Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new public method handleLoginSuccess lacks javadoc documentation. Add a javadoc comment explaining the method's purpose, parameters (@param client, @param loginStatus, @param userName), return value (@return), and the exception it throws (@throws ClientException).

Suggested change
/**
* Handles post-login success actions such as displaying login notifications,
* setting environment and server names, and updating UI settings.
*
* @param client The client instance used to retrieve server settings and acknowledge notifications.
* @param loginStatus The status of the login attempt.
* @param userName The username of the logged-in user.
* @return {@code true} if login success actions are completed and the user accepted any required notifications; {@code false} otherwise.
* @throws ClientException If an error occurs while retrieving server settings or acknowledging notifications.
*/

Copilot uses AI. Check for mistakes.
try {
PublicServerSettings publicServerSettings = client.getPublicServerSettings();

if (publicServerSettings.getLoginNotificationEnabled() == true) {
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid explicit boolean comparisons. Instead of if (publicServerSettings.getLoginNotificationEnabled() == true), use if (publicServerSettings.getLoginNotificationEnabled()).

Suggested change
if (publicServerSettings.getLoginNotificationEnabled() == true) {
if (publicServerSettings.getLoginNotificationEnabled()) {

Copilot uses AI. Check for mistakes.
CustomBannerPanelDialog customBannerPanelDialog = new CustomBannerPanelDialog(loginPanel, "Login Notification", publicServerSettings.getLoginNotificationMessage());
boolean isAccepted = customBannerPanelDialog.isAccepted();

if (isAccepted == true) {
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid explicit boolean comparisons. Instead of if (isAccepted == true), use if (isAccepted).

Suggested change
if (isAccepted == true) {
if (isAccepted) {

Copilot uses AI. Check for mistakes.
@tonygermano tonygermano requested a review from NicoPiel December 14, 2025 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants