User registration sample reset password missing to lowarcase and unable to open user detail screen

Hi

I was looking at the sample sample-user-registration/RestorePasswordScreen.java at master · cuba-platform/sample-user-registration · GitHub
and I think there is a toLowerCase() missing when checking for login (and a trim to help users with Android Keyboards adding spaces :wink: ).
.setParameter(“login”, loginField.getValue());
should likely be
.setParameter(“login”, loginField.getValue().trim().toLowerCase());

Is there a reason (other than “it is a sample” :wink: ) to not have moved the user existence check to the service (I even suspect this already exists somewhere in the platform)?

Also note that when I use the “register” feature, I cannot open the user in the admin section because one of the 2 roles is linked to a “null” role and this results in a Null Pointer Exception - tested with 7.2.7 release. (this is odd that it is even possible to create such a link).

Caused by: java.lang.NullPointerException: null
at com.haulmont.cuba.gui.app.security.user.edit.UserEditor.filterRolesDs(UserEditor.java:296) ~[cuba-gui-7.2.7.jar:7.2.7]
at com.haulmont.cuba.gui.app.security.user.edit.UserEditor.postInit(UserEditor.java:257) ~[cuba-gui-7.2.7.jar:7.2.7]

So Probably something to improve in the Users detail screen (prevent NPE), maybe datamodel (do not allow null roles) and maybe in the register (to check if the default hardcoded role exists?)

Also maybe useful to draw attention in the readme about the security remark in app.configabout"cuba.rest.anonymousEnabled = true" and explain which access needs to be granted (I have so far the sec$User create, read and update)

Kind regards
Thierry

Hi,

It’s a sample :grinning: Also, you don’t need to trim the value by yourself, the TextField does it by default, see the docs.

Unfortunately, I can’t reproduce the problem. I successfully migrated the sample project to 7.2.7 and have no exceptions. If you adopted the sample project to your own, could you please attach a demo project where the problem is reproduced?

Regards,
Gleb