Studio problems when setting passwordFields to required="true"

Jmix version: 1.5.1
Jmix Studio plugin version: 1.5.2-231
IntelliJ IDEA 2023.1 (Community Edition)
Build #IC-231.8109.175, built on March 28, 2023
Runtime version: 17.0.6+10-b829.5 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
GC: G1 Young Generation, G1 Old Generation
Kotlin: 231-1.8.20-IJ8109.175
Java 17.0.4 2022-07-19 LTS
Java™ SE Runtime Environment (build 17.0.4+11-LTS-179)
Java HotSpot™ 64-Bit Server VM (build 17.0.4+11-LTS-179, mixed mode, sharing)
Operating System: macOS 13.2.1 (22D68)
File System: Case-Sensitive Journaled HFS+ (APFS)
Database: PostgreSQL 13

Hello Everyone

For your information, I have several problems with Studio when I modify an ExtChangePasswordDialog screen that I migrated from CUBA last year.

Problem 1 - When I open the attribute inspector it shows that “visible” is “false” (not selected) for my currentPasswordField but this value is not shown in the screen descriptor XML.

currentPasswordField_before_setting_required

Here is my original ext-change-password-dialog.xml file BEFORE setting currentPasswordField required=“true”

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window" xmlns:ext="http://jmix.io/schema/ui/window-ext"
        extends="io/jmix/securityui/screen/changepassword/change-password-dialog.xml">
    <layout>
        <label value="Length 10 - 20, 1 uppercase, 1 number, 1 special" ext:index="0"/>
        <form id="form">
            <passwordField id="currentPasswordField" caption="msg://ChangePasswordDialog.currentPassword"/>
            <passwordField id="passwordField"
                           caption="msg://ChangePasswordDialog.password"/>
            <passwordField id="confirmPasswordField"
                           caption="msg://ChangePasswordDialog.confirmPassword"/>
        </form>
    </layout>
</window>

This is the same descriptor AFTER I set the currentPasswordField "required=“true”; studio sets visible=“false” (and adds other content to the file).

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window" xmlns:ext="http://jmix.io/schema/ui/window-ext">
    <dialogMode forceDialog="true" width="AUTO" height="AUTO"/>
    <layout spacing="true">
        <label value="Length 10 - 20, 1 uppercase, 1 number, 1 special"/>
        <form id="form">
            <passwordField id="currentPasswordField" caption="msg://ChangePasswordDialog.currentPassword"
                           visible="false" required="true"/>
            <passwordField id="passwordField"
                           caption="msg://ChangePasswordDialog.password"/>
            <passwordField id="confirmPasswordField"
                           caption="msg://ChangePasswordDialog.confirmPassword"/>
        </form>
        <hbox id="actionsBox" align="MIDDLE_RIGHT" spacing="true">
            <button id="okBtn" caption="msg:///actions.Ok" shortcut="ENTER"/>
            <button id="cancelBtn" caption="msg:///actions.Cancel"/>
        </hbox>
    </layout>
</window>

currentPasswordField_after_setting_required

When I run the application, the currentPasswordField is still displayed, even though visible=“false”, and the currentPasswordField has a red border indicating “required” (expected behavior).

ExtChangePasswordDialog_after_setting_currentPasswordField_required

And then when I set currentPasswordField required=“false” (just checking the inspector functionality), it does not change it in the descriptor.

currentPasswordField_after_resetting_required

Problem 2 - When I set the other two passwordFields: passwordField, confirmPasswordField also to required=“true”, I see the settings in the attribute inspector but not in the screen descriptor and when I run my application, the passwordField and confirmPasswordField are not required (expected behavior because they were not updated in the screen descriptor).

BEFORE
passwordField_before_setting_required

AFTER
passwordField_after_setting_required

BEFORE
confirmPasswordField_before_setting_required

AFTER
confirmPasswordField_after_setting_required

When I reload the screen descriptor, the attributes are not set in the inspector (expected behavior because they were not updated in the descriptor’s file).

If I manually edit the screen descriptor and remove something at random, e.g.

BEFORE

<label value="Length 10 - 20, 1 uppercase, 1 number, 1 special"/>

AFTER

<label value="Length 10 - 20, 1 uppercase, 1 number, 1 special/>

random_modify

and then revert to the original value…
REVERTED

<label value="Length 10 - 20, 1 uppercase, 1 number, 1 special"/>

then my changes to all of the passwordFields are updated in the descriptor as expected…

passwordField_after_random_modify_required

confirmPasswordField_after_random_modify_required

As a workaround, I have edited the descriptor manually and added required=“true” to all three fields and removed visible=“false”.

Can you please resolve these problems at your convenience.

Thanks in advance.

Best regards
Chris

Hello!

Thank you for your detailed description of your issues. I analyzed these cases, in the first case you also need to pay attention to the original screen controller code io.jmix.securityui.screen.changepassword.ChangePasswordDialog: the withCurrentPasswordRequired method sets the visibility value based on the required parameter, which overrides the changes in the xml file. You can override this method in your controller by setting the field’s visibility to the desired value. The problems described in the second case will soon be fixed as part of the ticket for the completion of screen extensions, which I am working on.

@t.musin

Hello Timur

Thank you for the information and your support.

Best regards
Chris