1

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Are you getting any errors in your chrome console (hit f12 key)? – jjtbsomhorst Jun 17 '13 at 12:16
  • No, unfortunately not. Not in my log, not on the server console, not in the browser console, that's why I am bit depressed about this problem, absolutely no point where I could figure out what could go wrong. I am hoping that someone had a similar problem and knows what I could try to figure it out. – Matthias Nicklisch Jun 17 '13 at 12:19
  • And on both servers the "if(String(data).substring(0,3).toUpperCase() == "GIF") {" is evaluated correctly? – jjtbsomhorst Jun 17 '13 at 16:47
  • Yes, it is evaluated correctly in both Browsers on both servers. It is evaluated to GIF – Matthias Nicklisch Jun 18 '13 at 08:20
  • If you have a look in your chrome's network console, is the session cookie set up correctly? You should see the cookie in HTTP headers sent to the server when redirecting to the XPage after the log in. – Sven Hasselbach Jun 18 '13 at 10:05

1 Answers1

0

Ok... the problem is fu.... fixed.... I have wasted nearly 2 work days because fu... Chrome is not able to delete his fu... cookies properly... I have deleted my cookies via the Browseroption "Delete all Browser Data" This time I have deleted them via my Web Developer Tools.. now it fu... works...

Can't believe this....

But what has gone wrong there? Why wasn't I able to login just because the cookies weren't deleted?

  • Have a look here, maybe this is the bug you had have trouble with: http://stackoverflow.com/questions/10617954/chrome-doesnt-delete-session-cookies. And please accept your own answer to mark this question as solved. – Sven Hasselbach Jun 18 '13 at 11:59