Project

General

Profile

« Previous | Next » 

Revision 4628

Added by daigle over 15 years ago

Catch login errors and report the details via an exception.

View differences:

LoginAdmin.java
101 101
			Vector<String> processingErrors = new Vector<String>();
102 102
			Vector<String> validationErrors = new Vector<String>();
103 103
			
104
//			String loginString = null;
105 104
			Boolean isLoggedIn = false;
106 105
			String userName = "";
107 106

  
108
			try {
109 107
				userName = request.getParameter("username");
110
//				String organization = request.getParameter("organization");
111 108
				String password = request.getParameter("password");
112 109
				
113 110
				// Validate that the options provided are legitimate. Note that
......
117 114
				validationErrors.addAll(validateOptions(request));
118 115
				
119 116
				if (validationErrors.size() == 0) {
120
//					Vector<String> dnList = OrganizationUtil.getOrgDNs(organization);
121
					isLoggedIn = AuthUtil.logUserIn(request, userName, password);
122
//					loginString = LDAPUtil.createLDAPString(userName, organization, dnList);
117
					try {
118
						isLoggedIn = AuthUtil.logUserIn(request, userName, password);
119
					} catch (UtilException ue) {
120
						String errorMessage = "Could not log in as: " + userName
121
						+ " : " + ue.getMessage() + ". Please try again";
122
						processingErrors.add(errorMessage);
123
						logMetacat.error(errorMessage);
124
					} 
123 125
				}
124
				
125
				if (!isLoggedIn) {
126
					String errorMessage = "Could not log in as: " + userName
127
							+ " .Please try again";
128
					processingErrors.add(errorMessage);
129
				}
130
			} catch (UtilException ue) {
131
				String errorMessage = "Problem in utility while "
132
					+ "processing entication page: " + ue.getMessage();
133
				processingErrors.add(errorMessage);
134
				logMetacat.error(errorMessage);
135
			} 
136 126
			
137 127
			try {
138 128
				if (validationErrors.size() > 0 || processingErrors.size() > 0) {

Also available in: Unified diff