Better parsing for Login Widgets

Have a hybrid app out in the wild and 95% of user login issues are because Android auto-fill puts a space at the end of the login/email (we use email as the login name).  Is there a way to parse out spaces on the front and back of whatever is typed into the login name before attempting a login automatically?  
2 answers

You have 2 options I think:

A) add code to the front-end (in the form of JS or a widget) that cleans up the username before it's submitted to log a user in.

B) add code to the back-end (in the form of a custom login handler) that cleans up that username


The solution to A depends on which widgets you're using on the sign-on page (login widgets in Mx7, login form widget from the app store). In fact you could consider this a bug that should be fixed by Mendix if it's happening with the standard Mx7 login widgets.


Drop an HTMLSnippet widget directly after the login ID widget, set it to JavaScript mode, and put this in it:

this.domNode.previousSibling.children[1].children[0].onchange = function() {this.value = this.value.trim() }


The solution to B would be to create a custom login handler in Java. Something like this, except it should just clean up the username using the trim() method and then passing it to the standard login handler.


Yeah, we're using the standard login widgets.  Had hundreds of people not able to login because the android auto-fill email puts a space at the end of the email.  I would think this is a bug or at lease not best practice to not clean up those leading and trailing spaces in the username (unless Mendix usernames can have spaces at the end?)