1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-04 14:52:24 -05:00

Allow identical username/userid in multiple factor authentication form

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2167 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2013-08-25 16:14:01 +00:00
parent 79f93e331b
commit 69346f7c31

View File

@ -568,18 +568,20 @@ public abstract class ExchangeSession {
protected void setAuthFormFields(HttpMethod logonMethod, HttpClient httpClient, String password) throws IllegalArgumentException {
String userNameInput;
if (userNameInputs.size() == 2) {
String userid;
// multiple username fields, split userid|username on |
int pipeIndex = userName.indexOf('|');
if (pipeIndex < 0) {
LOGGER.warn("Multiple user fields detected, please use userid|username as user name in client");
LOGGER.debug("Multiple user fields detected, please use userid|username as user name in client, except when userid is username");
userid = userName;
} else {
String userid = userName.substring(0, pipeIndex);
((PostMethod) logonMethod).removeParameter("userid");
((PostMethod) logonMethod).addParameter("userid", userid);
userid = userName.substring(0, pipeIndex);
userName = userName.substring(pipeIndex + 1);
// adjust credentials
DavGatewayHttpClientFacade.setCredentials(httpClient, userName, password);
}
((PostMethod) logonMethod).removeParameter("userid");
((PostMethod) logonMethod).addParameter("userid", userid);
userNameInput = "username";
} else if (userNameInputs.size() == 1) {