we have a little problem with our login module for one of our XPages applications.
We have used the XPages login module from http://www.qtzar.com/dslh-7qpr7x/ as base. The login module works just fine in all Browsers, even mobile (in a slightly different version) but it won't work in Chrome. In Chrome I see the Icon that the login was successful, but after the reload, nothing has happened, and I'm not logged in.
We have tested a lot of Variations, currently we have switched the AJAX Method vom Dojo to JQuery, but that didn't changed anything, either.
This is the current Source Code:
<xc:bcc_basic_user
loaded="${javascript: getUserRoles.indexOf('Admin')==-1}"
rendered="#{javascript:isLoggedIn;}" />
<xc:bcc_basic_admin
loaded="${javascript: getUserRoles.indexOf('Admin')!=-1}"
rendered="#{javascript:isLoggedIn;}" />
<!--
The following methods for user log in are taken from or based on
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=XPages%20Sliding%20Login%20Custom%20Control#
and underly the Apache License For more information on how this works
see: http://www.qtzar.com/blog/dslh-7qps3g/
-->
<xp:scriptBlock id="loginScript" type="text/javascript">
<xp:this.value>
<![CDATA[
function doLogin() {
var username = dojo.byId("#{id:cc_login_panel_login_username}").value;
var password = dojo.byId("#{id:cc_login_panel_login_password}").value;
if (username!=null && username.length>0 && password!=null && password.length>0) {
dojo.style("#{id:cc_login_panel_login_failed}","display","none");
dojo.style("#{id:cc_login_panel_login_notauth}","display","none");
dojo.style("#{id:cc_login_panel_login_wait}","display","block");
var postData = {
"username" : username,
"password" : password,
"RedirectTo": "#{javascript:BCCJSFUtils.getDatabasePath(false)}/img/waiting.gif"
};
$.ajax({
url: '#{javascript:session.getServerName()}/names.nsf?Login',
data: postData,
type: 'POST',
async: false,
cache: false,
success: function (data) {
alert("onComplete");
if(String(data).substring(0,3).toUpperCase() == "GIF") {
dojo.style("#{id:cc_login_panel_login_wait}","display","none");
dojo.style("#{id:cc_login_panel_login_success}","display","block");
var url = window.location.href;
if (url.indexOf(".xsp")==-1) {
if (url.substring(url.length-1,url.length)!='/') {
url += '/';
}
url += "#{javascript:getLandingPage}";
}
if (url.indexOf('?')!=-1) {
url += "&doRefresh=true";
} else {
url += "?doRefresh=true";
}
window.location.href = url;
return false;
} else {
if (dojo.cookie('DomAuthSessId') != null || dojo.cookie('LtpaToken') != null) {
dojo.style("#{id:cc_login_panel_login_wait}","display","none");
dojo.style("#{id:cc_login_panel_login_notauth}","display","block");
dojo.cookie('DomAuthSessId', null, { path: '/', domain: 'bcc.biz' });
dojo.cookie('LtpaToken', null, { path: '/', domain: 'bcc.biz' });
} else {
dojo.style("#{id:cc_login_panel_login_wait}","display","none");
dojo.style("#{id:cc_login_panel_login_failed}","display","block");
}
}
},
error: function (error) {
alert("onError");
console.error ('Error: ', error);
//IE Has An Issue with returning binary data in AJAX so just reload the page.
console.error ('Possibly Running IE - Reloading Page Anyway');
var url = window.location.href;
if (url.indexOf(".xsp")==-1) {
if (url.substring(url.length-1,url.length)!='/') {
url += '/';
}
url += "#{javascript:getLandingPage}";
}
if (url.indexOf('?')!=-1) {
url += "&doRefresh=true";
} else {
url += "?doRefresh=true";
}
window.location.href = url;
return false;
}
});
}
}]]>
</xp:this.value>
</xp:scriptBlock>
<xp:div styleClass="btn-group pull-right" rendered="${javascript:!isLoggedIn}">
<xp:panel id="cc_login_panel_login_content">
<xp:inputText id="cc_login_panel_login_username"
styleClass="span2">
<xp:eventHandler event="onkeypress" submit="false">
<xp:this.script><![CDATA[
if (thisEvent.keyCode!=13) {
return false;
} else {
doLogin();
}]]>
</xp:this.script>
</xp:eventHandler>
</xp:inputText>
<xp:inputText id="cc_login_panel_login_password"
styleClass="span2" password="true">
<xp:eventHandler event="onkeypress" submit="false">
<xp:this.script><![CDATA[
if (thisEvent.keyCode!=13) {
return false;
} else {
doLogin();
}]]>
</xp:this.script>
</xp:eventHandler>
</xp:inputText>
<xp:button value="${basicLang['LOGIN']}" id="cc_login_panel_login_button"
styleClass="btn pull-right" style="font-weight:bold;margin-left:4px;">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[doLogin();]]></xp:this.script>
</xp:eventHandler>
</xp:button>
</xp:panel>
<xp:panel id="cc_login_panel_login_wait" style="display:none;">
<ul class="login-info navbar-background" style="width:100%;">
<li>
<span>
<xp:image url="img/waiting.gif" id="image1" height="16"
width="16" />
</span>
</li>
<li>
<xp:text value="${basicLang['CHECKING_CREDENTIALS']}" id="label2"
styleClass="text-info" style="padding: 0px 5px; font-weight: bold;" tagName="div" />
<br />
<xp:text value="${basicLang['PLEASE_WAIT']}" id="label1" style="padding: 0px 5px;"
tagName="div" />
</li>
</ul>
</xp:panel>
<xp:panel id="cc_login_panel_login_success" style="display:none;">
<ul class="login-info navbar-background" style="width:100%;">
<li>
<span>
<i class="icon-ok" />
</span>
</li>
<li>
<xp:text value="${basicLang['LOGIN_SUCCESSFUL']}" id="label4"
styleClass="text-success" style="padding: 0px 5px; font-weight: bold;" tagName="div" />
</li>
</ul>
</xp:panel>
<xp:panel id="cc_login_panel_login_failed" style="display:none;">
<ul class="login-info navbar-background" style="width:100%;">
<li>
<span>
<i class="icon-remove" />
</span>
</li>
<li>
<xp:text value="${basicLang['LOGIN_FAILED']}" id="label3"
styleClass="text-warning" style="padding: 0px 5px; font-weight: bold;" tagName="div" />
</li>
</ul>
</xp:panel>
<xp:panel id="cc_login_panel_login_notauth" style="display:none;">
<ul class="login-info navbar-background" style="width:100%;">
<li>
<span>
<i class="icon-ban-circle" />
</span>
</li>
<li>
<xp:text value="${basicLang['NOT_AUTHORIZED']}" id="label6"
styleClass="text-warning" style="padding: 0px 5px; font-weight: bold;" tagName="div" />
</li>
</ul>
</xp:panel>
</xp:div>
We have tested the code on another server, the interesting thing, on this server it works even in Chrome... We have looked for differences between the servers. We saw that on the first server (where it doesn't work) there is "Force SSL on Login" set to true, but it didn't changed anything when we set it to false. Another difference is that this first server is a Domino 9 Server and the server where it works is a 8.5.2 Server.
Do you have any idea what could go wrong there? I am trying to get it to work for two days now and I'm running out of ideas what could be the cause of this problem. As I said, in all Browsers it works fine, except in Chrome. But it works on another server in Chrome.
If you need more information I will post them.
Thanks in advance.