Login Form widget not remembering user details

3
I am trying the Login Form widget from the app store and it seems to largely work OK, but I am having problems with the setting to remember the current user. I have the 'Show automatically signin checkbox' set to true and have added the line to my index.html page to include the CookieExtender.js However, that doesn't seem to work. Some sort of cookie is being created, but when I log out and then log back in, the username is not pre-populated in the Username field as I would expect. What am I missing? Edit: Does anyone have the 'remember me' functionality of the login form widget working properly? Edit 14 April: I notice in firebug I get an error reported for CookieExtender.js: mx is not defined (line 1) (function(){var a=function(){if(/true/.test(dojo.cookie("EXTENDCOOKIE"))){dojo.cookie("XASID",dojo.cookie("XASID"),{expires:365});dojo.cookie("XASSESSIONID",dojo.cookie("XASSESSIONID"),{expires:365})}};dojo.connect(mx.session,"startup",a);dojo.connect(mx.session,"restart",a);a()})(); Could this be related? Edit: Daniel, here is part of the index.html page: <html> <head> <title>e-Service Suite</title> <meta http-equiv="expires" content="0" /> <meta http-equiv="pragma" content="no-cache" /> <LINK REL="SHORTCUT ICON" HREF="http://www.buoyantsolutions.net/eSS-Icon.ico"> <link rel="apple-touch-icon" href="http://www.e-servicesuite.com/apple-ess-icon.png" /> <meta http-equiv="X-UA-Compatible" content="chrome=1" /> <script type="text/javascript" src="mxclientsystem/dojo/dojo.js" djConfig=" usePlainJson: true, rtlRedirect: 'index-rtl.html' "> </script> <script type="text/javascript" src="mxclientsystem/mendix/mendix.js"></script> <script type="text/javascript" src="widgets/loginsystem/lib/CookieExtender.js"></script> mendix.js is included once, and the end of the HEAD section, not the end of the body
asked
4 answers
5

Ok, I dove a bit into the problem, and this is what is happening:

...However, that doesn't seem to work. Some sort of cookie is being created, but when I log out and then log back in, the username is not pre-populated in the Username field as I would expect.

True. The cookie extender / 'remember me' functionality does NOT populate the login fields, but, it will automatically log you in when you close and re-open the browser. It just prolongs your session with a year, but if you log out manually, the session is still destroyed. So this function does actually prevent sessions from expiring, which might not be very useful after all.

The reason that the browser does not remember the passwords has nothing to do with the browser settings (unless that feature is disabled at all ;-)), but is caused by the fact that the login form does not actually contain a <form> element. That can be solved in the widget and will cause Firefox and older IE versions to remember login details from now on, if desired.

In Chrome/ Opera/ Safari however, the issue remains, because although a form is used, the form is never submitted to the server by the browser directly (that is done in the background by Ajax). Therefor the browser thinks the form was never submitted, and does not offer to remember the details.

The only way to really solve this problem, is to write a small login servlet which accepts normal form submits. (Note that this functionality is already in the deeplink module)

answered
4

Is CookieExtender.js included after mendix.js is included in your index file, as described in the documentation of the widget? Since not doing so may cause the "mx is not defined" error, and might also cause the widget to not work properly. (mendix.js should be included once, at the end of the body of the page)

answered
1

Really strange. Similar issue as the missing "save password in firefox" in the default login form in the default index.html. When you navigate to the login.html, firefox will ask you to remember your credentials. When you navigate to the index.html firefox doesn't ask you to save your credentials.

Do you see a difference between firefox and IE?

Edit after test in 2.5.4:

David, i've tried to reproduced this, but it works in my app in FF4. I used 2.4.3 and tested it in FF4 and IE9. FF4 works, even if i don't check the signin checkbox, so this is really strange. I don't see your error in my firebug. It works, till I click the logout button. But in IE9 it doesn't work at all. Really need to log in every time.

answered
1

I found the following on StackOverflow

You should look at the Mozilla Password Manager Debugging page and the nsILoginManager docs for extension writers (just for the nitty gritty technical details of how Firefox deals with password management). You can dig into the answers there and other pages linked there to find out more than you probably ever wanted to know about how the password manager interacts with sites and extensions.

(Specifically as pointed out in the password manager debugging doc, make sure you don't have autocomplete set to off in your html, as that will suppress the prompt to save the username and password)

answered