mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-07 03:38:05 -05:00
Support multiple forms in form based authentication logon page
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@936 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
b2b84b7285
commit
21504d6828
@ -385,13 +385,23 @@ public class ExchangeSession {
|
|||||||
try {
|
try {
|
||||||
TagNode node = cleaner.clean(initmethod.getResponseBodyAsStream());
|
TagNode node = cleaner.clean(initmethod.getResponseBodyAsStream());
|
||||||
List forms = node.getElementListByName("form", true);
|
List forms = node.getElementListByName("form", true);
|
||||||
|
TagNode logonForm = null;
|
||||||
|
// select form
|
||||||
if (forms.size() == 1) {
|
if (forms.size() == 1) {
|
||||||
TagNode form = (TagNode) forms.get(0);
|
logonForm = (TagNode) forms.get(0);
|
||||||
String logonMethodPath = form.getAttributeByName("action");
|
} else if (forms.size() > 1) {
|
||||||
|
for (Object form : forms) {
|
||||||
|
if ("logonForm".equals(((TagNode) form).getAttributeByName("name"))) {
|
||||||
|
logonForm = ((TagNode) form);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (logonForm != null) {
|
||||||
|
String logonMethodPath = logonForm.getAttributeByName("action");
|
||||||
|
|
||||||
logonMethod = new PostMethod(getAbsoluteUri(initmethod, logonMethodPath));
|
logonMethod = new PostMethod(getAbsoluteUri(initmethod, logonMethodPath));
|
||||||
|
|
||||||
List inputList = form.getElementListByName("input", true);
|
List inputList = logonForm.getElementListByName("input", true);
|
||||||
for (Object input : inputList) {
|
for (Object input : inputList) {
|
||||||
String type = ((TagNode) input).getAttributeByName("type");
|
String type = ((TagNode) input).getAttributeByName("type");
|
||||||
String name = ((TagNode) input).getAttributeByName("name");
|
String name = ((TagNode) input).getAttributeByName("name");
|
||||||
@ -1487,6 +1497,7 @@ public class ExchangeSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set IMAP uid.
|
* Set IMAP uid.
|
||||||
|
*
|
||||||
* @param imapUid new uid
|
* @param imapUid new uid
|
||||||
*/
|
*/
|
||||||
public void setImapUid(long imapUid) {
|
public void setImapUid(long imapUid) {
|
||||||
|
Loading…
Reference in New Issue
Block a user