Changeset 37312 for main


Ignore:
Timestamp:
2023-02-13T12:11:19+13:00 (15 months ago)
Author:
kjdon
Message:

added dialog to display authentication error to user

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r37236 r37312  
    284284        webswingAuthenticator = new WebswingAuthenticator();
    285285        if (!webswingAuthenticator.authenticate(library_url_string)) {
    286             System.err.println("authentication error");
     286            System.err.println("Authentication error, quitting GLI");
    287287            System.exit(0);
    288288        }
     
    19681968        static protected HashSet<String> groups;
    19691969
     1970        protected void displayError(String error_message) {
     1971        WarningDialog dialog = new WarningDialog("warning.AuthenticationError", Dictionary.get("WebswingAuthenticationError.Title"), error_message, null, false, false);
     1972
     1973        dialog.display();
     1974        dialog.dispose();
     1975        dialog = null;
     1976        }
     1977
    19701978        public boolean authenticate(String library_url_string) {
    19711979        PasswordAuthentication pa = getPasswordAuthentication();
    19721980        if (pa == null) {
    1973             // user cancelled - how do we show error?
    1974             System.err.println("Authentication cancelled. You cannot access webswing gli without Greenstone user account");
     1981            // user cancelled
     1982            System.err.println("Authentication cancelled.");
     1983            displayError(Dictionary.get("WenswingAuthenticationError.Cancelled"));
    19751984            return false;
    19761985
     
    19932002        } catch (Exception e) {
    19942003            System.err.println("There was an exception "+e.getMessage());
     2004            displayError("There was an exception "+e.getMessage());
    19952005            return false;
    19962006        }
     
    20052015        if (result.startsWith("Authentication failed:")) {
    20062016            System.err.println("Authentication Error: "+result);
     2017            displayError(result.replaceAll("&apos;", "'"));
    20072018            return false;
    20082019        }
     
    20162027        }
    20172028        if (groups.size()==0) {
     2029            System.err.println("User not in any collection editing groups");
     2030            displayError(Dictionary.get("WebswingAuthenticationError.NoPermissions"));
    20182031            return false; // user has no editing priveleges
    20192032        }
Note: See TracChangeset for help on using the changeset viewer.