From 42bd32b250e7e9fb9dbfe5ee472ec105a551e734 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Fri, 23 Feb 2024 15:26:18 +0530
Subject: [PATCH 01/32] Initial commit for the AF password box core component
---
.../internal/form/FormConstants.java | 1 +
.../internal/models/v1/form/PasswordImpl.java | 90 +++++++++++
.../core/components/models/form/Password.java | 32 ++++
.../components/adaptive-form/password.less | 3 +
.../components/form/password/.content.xml | 7 +
.../components/form/password/_cq_template.xml | 5 +
.../.content.xml | 2 +-
.../fd/components/form/password/.content.xml | 3 +
.../components/form/password/v1/.content.xml | 4 +
.../form/password/v1/password/.content.xml | 8 +
.../form/password/v1/password/README.md | 91 +++++++++++
.../password/_cq_design_dialog/.content.xml | 78 ++++++++++
.../v1/password/_cq_dialog/.content.xml | 142 ++++++++++++++++++
.../password/v1/password/_cq_template.xml | 5 +
.../v1/password/clientlibs/.content.xml | 3 +
.../password/clientlibs/editor/.content.xml | 5 +
.../v1/password/clientlibs/editor/js.txt | 18 +++
.../clientlibs/editor/js/editDialog.js | 39 +++++
.../v1/password/clientlibs/site/.content.xml | 6 +
.../v1/password/clientlibs/site/css.txt | 18 +++
.../clientlibs/site/css/passwordview.css | 15 ++
.../v1/password/clientlibs/site/js.txt | 19 +++
.../clientlibs/site/js/passwordview.js | 87 +++++++++++
.../site/js/togglepasswordvisibility.js | 28 ++++
.../form/password/v1/password/password.html | 58 +++++++
.../form/password/v1/password/password.js | 34 +++++
26 files changed, 800 insertions(+), 1 deletion(-)
create mode 100644 bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
create mode 100644 bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
create mode 100644 examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/clientlibs/forms-clientlib-site/styles/components/adaptive-form/password.less
create mode 100644 examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/.content.xml
create mode 100644 examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/.content.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/.content.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/.content.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_design_dialog/.content.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_template.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/.content.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/.content.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/js.txt
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/js/editDialog.js
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css.txt
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.js
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
index 2944ee3f6c..44126e8b8f 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
@@ -142,4 +142,5 @@ private FormConstants() {
/* The resource type for the pre-selected the linked panel */
public final static String RT_FD_FORM_REVIEW_DATASOURCE_V1 = RT_FD_FORM_PREFIX + "review/v1/datasource";
+ public static final String RT_FD_FORM_PASSWORD_V1 = RT_FD_FORM_PREFIX + "password/v1/password";
}
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
new file mode 100644
index 0000000000..b8d2de195e
--- /dev/null
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -0,0 +1,90 @@
+/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2024 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+package com.adobe.cq.forms.core.components.internal.models.v1.form;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Default;
+import org.apache.sling.models.annotations.Exporter;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
+
+import com.adobe.cq.export.json.ComponentExporter;
+import com.adobe.cq.export.json.ExporterConstants;
+import com.adobe.cq.forms.core.components.internal.form.FormConstants;
+import com.adobe.cq.forms.core.components.models.form.Password;
+import com.adobe.cq.forms.core.components.util.AbstractFieldImpl;
+
+@Model(
+ adaptables = { SlingHttpServletRequest.class, Resource.class },
+ adapters = { Password.class, ComponentExporter.class },
+ resourceType = { FormConstants.RT_FD_FORM_PASSWORD_V1 })
+@Exporter(
+ name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
+ extensions = ExporterConstants.SLING_MODEL_EXTENSION)
+public class PasswordImpl extends AbstractFieldImpl implements Password {
+
+ @ValueMapValue
+ @Default(values = "")
+ private String validationPattern;
+
+ @Override
+ public String getFieldType() {
+ return super.getFieldType();
+ }
+
+ @Override
+ public Integer getMinLength() {
+ return minLength;
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ @Override
+ public Long getMinimum() {
+ return minimum;
+ }
+
+ @Override
+ public Long getMaximum() {
+ return maximum;
+ }
+
+ @Override
+ public Long getExclusiveMaximum() {
+ return exclusiveMaximum;
+ }
+
+ @Override
+ public Long getExclusiveMinimum() {
+ return exclusiveMinimum;
+ }
+
+ @Override
+ public String getFormat() {
+ return displayFormat;
+ }
+
+ @Override
+ public String getValidationPattern() {
+ return validationPattern;
+ }
+
+}
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
new file mode 100644
index 0000000000..0f8bea8956
--- /dev/null
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
@@ -0,0 +1,32 @@
+/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2024 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+package com.adobe.cq.forms.core.components.models.form;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+@ConsumerType
+public interface Password extends Field, StringConstraint, NumberConstraint {
+
+ /**
+ * Returns the validation pattern (regex) for the password field.
+ *
+ * @return the validation pattern
+ * @since com.adobe.cq.forms.core.components.models.form 1.0.0
+ */
+ String getValidationPattern();
+
+}
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/clientlibs/forms-clientlib-site/styles/components/adaptive-form/password.less b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/clientlibs/forms-clientlib-site/styles/components/adaptive-form/password.less
new file mode 100644
index 0000000000..070e26a5da
--- /dev/null
+++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/clientlibs/forms-clientlib-site/styles/components/adaptive-form/password.less
@@ -0,0 +1,3 @@
+.cmp-adaptiveform-password {
+ .inputMixin();
+ }
\ No newline at end of file
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/.content.xml
new file mode 100644
index 0000000000..acb1cd0182
--- /dev/null
+++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/.content.xml
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml
new file mode 100644
index 0000000000..fd92ff415e
--- /dev/null
+++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml
index 0ef50cf14f..4c45390ac7 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-components-runtime-all/.content.xml
@@ -5,4 +5,4 @@
cssProcessor="[default:none,min:none]"
jsProcessor="[default:none,min:none]"
categories="[core.forms.components.runtime.all]"
- embed="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.textinput.v1.runtime,core.forms.components.numberinput.v1.runtime,core.forms.components.panelcontainer.v1.runtime,core.forms.components.radiobutton.v1.runtime,core.forms.components.text.v1.runtime,core.forms.components.checkboxgroup.v1.runtime,core.forms.components.button.v1.runtime,core.forms.components.image.v1.runtime,core.forms.components.dropdown.v1.runtime,core.forms.components.fileinput.v3.runtime,core.forms.components.accordion.v1.runtime,core.forms.components.tabs.v1.runtime,core.forms.components.wizard.v1.runtime,core.forms.components.verticaltabs.v1.runtime,core.forms.components.recaptcha.v1.runtime,core.forms.components.checkbox.v1.runtime,core.forms.components.fragment.v1.runtime,core.forms.components.switch.v1.runtime,core.forms.components.termsandconditions.v1.runtime, core.forms.components.hcaptcha.v1.runtime,core.forms.components.review.v1.runtime, core.forms.components.turnstile.v1.runtime]"/>
+ embed="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.textinput.v1.runtime,core.forms.components.numberinput.v1.runtime,core.forms.components.panelcontainer.v1.runtime,core.forms.components.radiobutton.v1.runtime,core.forms.components.text.v1.runtime,core.forms.components.checkboxgroup.v1.runtime,core.forms.components.button.v1.runtime,core.forms.components.image.v1.runtime,core.forms.components.dropdown.v1.runtime,core.forms.components.fileinput.v3.runtime,core.forms.components.accordion.v1.runtime,core.forms.components.tabs.v1.runtime,core.forms.components.wizard.v1.runtime,core.forms.components.verticaltabs.v1.runtime,core.forms.components.recaptcha.v1.runtime,core.forms.components.checkbox.v1.runtime,core.forms.components.fragment.v1.runtime,core.forms.components.switch.v1.runtime,core.forms.components.termsandconditions.v1.runtime, core.forms.components.hcaptcha.v1.runtime,core.forms.components.review.v1.runtime, core.forms.components.turnstile.v1.runtime, core.forms.components.password.v1.runtime]"/>
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/.content.xml
new file mode 100644
index 0000000000..491392d539
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/.content.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/.content.xml
new file mode 100644
index 0000000000..12d179732b
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/.content.xml
@@ -0,0 +1,4 @@
+
+
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/.content.xml
new file mode 100644
index 0000000000..b568963358
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/.content.xml
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
new file mode 100644
index 0000000000..87d7552110
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
@@ -0,0 +1,91 @@
+
+Adaptive Form Password (v1)
+====
+Adaptive Form Password field component written in HTL.
+
+## Features
+
+* Provides the following type of input:
+ * password
+
+* Custom constraint messages for the above types
+* Styles
+* Allows replacing this component with other component (as mentioned below).
+
+### Use Object
+The Form Password component uses the `com.adobe.cq.forms.core.components.models.form.Password` Sling Model for its Use-object.
+
+### Edit Dialog Properties
+The following properties are written to JCR for this Form Password component and are expected to be available as `Resource` properties:
+
+1. `./jcr:title` - defines the label to use for this field
+2. `./hideTitle` - if set to `true`, the label of this field will be hidden
+3. `./name` - defines the name of the field, which will be submitted with the form data
+4. `./default` - defines the default value of the field
+5. `./description` - defines a help message that can be rendered in the field as a hint for the user
+6. `./required` - if set to `true`, this field will be marked as required, not allowing the form to be submitted until the field has a value
+7. `./requiredMessage` - defines the message displayed as tooltip when submitting the form if the value is left empty
+8. `./readOnly` - if set to `true`, the filed will be read only
+
+## Client Libraries
+The component provides a `core.forms.components.password.v1.runtime` client library category that contains the Javascript runtime for the component.
+It should be added to a relevant site client library using the `embed` property.
+
+It also provides a `core.forms.components.password.v1.editor` editor client library category that includes
+JavaScript handling for dialog interaction. It is already included by its edit dialog.
+
+## BEM Description
+```
+BLOCK cmp-adaptiveform-password
+ ELEMENT cmp-adaptiveform-password__label
+ ELEMENT cmp-adaptiveform-password__label-container
+ ELEMENT cmp-adaptiveform-password__widget
+ ELEMENT cmp-adaptiveform-password__questionmark
+ ELEMENT cmp-adaptiveform-password__shortdescription
+ ELEMENT cmp-adaptiveform-password__longdescription
+ ELEMENT cmp-adaptiveform-password__errormessage
+```
+
+### Note
+By placing the class names `cmp-adaptiveform-password__label` and `cmp-adaptiveform-password__questionmark` within the `cmp-adaptiveform-password__label-container` class, you create a logical grouping of the label and question mark elements. This approach simplifies the process of maintaining a consistent styling for both elements.
+
+## Replace feature:
+We support replace feature that allows replacing Reset Button component to any of the below components:
+
+* Button
+* Date Picker
+* Email Input
+* Number Input
+* Reset Button
+* Submit Button
+* Telephone Input
+* Text Box
+
+## JavaScript Data Attribute Bindings
+
+The following attributes must be added for the initialization of the password component in the form view:
+ 1. `data-cmp-is="adaptiveFormPassword"`
+ 2. `data-cmp-adaptiveformcontainer-path="${formstructparser.formContainerPath}"`
+
+
+The following are optional attributes that can be added to the component in the form view:
+1. `data-cmp-valid` having a boolean value to indicate whether the field is currently valid or not
+2. `data-cmp-required` having a boolean value to indicate whether the field is currently required or not
+3. `data-cmp-readonly` having a boolean value to indicate whether the field is currently readonly or not
+4. `data-cmp-active` having a boolean value to indicate whether the field is currently active or not
+5. `data-cmp-visible` having a boolean value to indicate whether the field is currently visible or not
+6. `data-cmp-enabled` having a boolean value to indicate whether the field is currently enabled or not
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_design_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_design_dialog/.content.xml
new file mode 100644
index 0000000000..79e8649b56
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_design_dialog/.content.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
new file mode 100644
index 0000000000..b63ed7380a
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_template.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_template.xml
new file mode 100644
index 0000000000..fed340a46b
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_template.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/.content.xml
new file mode 100644
index 0000000000..491392d539
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/.content.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/.content.xml
new file mode 100644
index 0000000000..9db59eb5c7
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/.content.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/js.txt
new file mode 100644
index 0000000000..dd642eaed7
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/js.txt
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright 2022 Adobe
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+
+#base=js
+editDialog.js
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/js/editDialog.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/js/editDialog.js
new file mode 100644
index 0000000000..66e54543a5
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/editor/js/editDialog.js
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright 2024 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+(function($) {
+ "use strict";
+
+ var EDIT_DIALOG = ".cmp-adaptiveform-password__editdialog",
+ PASSWORD_MAXLENGTH = EDIT_DIALOG + " .cmp-adaptiveform-password__maxlength",
+ PASSWORD_MINLENGTH = EDIT_DIALOG + " .cmp-adaptiveform-password__minlength",
+ BASE_PLACEHOLDER = EDIT_DIALOG + " .cmp-adaptiveform-base__placeholder",
+ PASSWORD_VALUE = EDIT_DIALOG + " .cmp-adaptiveform-password__value",
+ PASSWORD_RICHTEXTVALUE = EDIT_DIALOG + " .cmp-adaptiveform-password__richtextvalue",
+ PASSWORD_VALIDATIONPATTERN = EDIT_DIALOG + " .cmp-adaptiveform-password__validationpattern",
+ PASSWORD_VALIDATIONFORMAT = EDIT_DIALOG + " .cmp-adaptiveform-password__validationformat",
+ Utils = window.CQ.FormsCoreComponents.Utils.v1;
+
+ function handleValidationPatternDropDown(dialog) {
+ Utils.handlePatternDropDown(dialog,PASSWORD_VALIDATIONPATTERN,PASSWORD_VALIDATIONFORMAT);
+ }
+
+ function handleValidationFormat(dialog){
+ Utils.handlePatternFormat(dialog,PASSWORD_VALIDATIONPATTERN,PASSWORD_VALIDATIONFORMAT);
+ }
+
+ Utils.initializeEditDialog(EDIT_DIALOG)(handleValidationPatternDropDown,handleValidationFormat);
+
+})(jQuery);
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml
new file mode 100644
index 0000000000..27631c55e6
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml
@@ -0,0 +1,6 @@
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css.txt
new file mode 100644
index 0000000000..768068f910
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css.txt
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright 2022 Adobe
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+
+#base=css
+passwordview.css
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
new file mode 100644
index 0000000000..229055b840
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright 2024 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
new file mode 100644
index 0000000000..78e5ac68f6
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright 2022 Adobe
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+
+#base=js
+passwordview.js
+togglepasswordvisibility.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
new file mode 100644
index 0000000000..40fcd8cf56
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright 2024 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+(function() {
+
+ "use strict";
+ class Password extends FormView.FormFieldBase {
+
+ static NS = FormView.Constants.NS;
+ /**
+ * Each FormField has a data attribute class that is prefixed along with the global namespace to
+ * distinguish between them. If a component wants to put a data-attribute X, the attribute in HTML would be
+ * data-{NS}-{IS}-x=""
+ * @type {string}
+ */
+ static IS = "adaptiveFormPassword";
+ static bemBlock = 'cmp-adaptiveform-password'
+ static selectors = {
+ self: "[data-" + this.NS + '-is="' + this.IS + '"]',
+ widget: `.${Password.bemBlock}__widget`,
+ label: `.${Password.bemBlock}__label`,
+ description: `.${Password.bemBlock}__longdescription`,
+ qm: `.${Password.bemBlock}__questionmark`,
+ errorDiv: `.${Password.bemBlock}__errormessage`,
+ tooltipDiv: `.${Password.bemBlock}__shortdescription`
+ };
+
+ constructor(params) {
+ super(params);
+ }
+
+ getWidget() {
+ return this.element.querySelector(Password.selectors.widget);
+ }
+
+ getDescription() {
+ return this.element.querySelector(Password.selectors.description);
+ }
+
+ getLabel() {
+ return this.element.querySelector(Password.selectors.label);
+ }
+
+ getErrorDiv() {
+ return this.element.querySelector(Password.selectors.errorDiv);
+ }
+
+ getTooltipDiv() {
+ return this.element.querySelector(Password.selectors.tooltipDiv);
+ }
+
+ getQuestionMarkDiv() {
+ return this.element.querySelector(Password.selectors.qm);
+ }
+
+ setModel(model) {
+ super.setModel(model);
+ if (this.widget.value !== '') {
+ this._model.value = this.widget.value;
+ }
+ this.widget.addEventListener('blur', (e) => {
+ this._model.value = e.target.value;
+ this.setInactive();
+ });
+ this.widget.addEventListener('focus', (e) => {
+ this.setActive();
+ });
+ }
+ }
+
+ FormView.Utils.setupField(({element, formContainer}) => {
+ return new Password({element, formContainer})
+ }, Password.selectors.self);
+
+})();
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
new file mode 100644
index 0000000000..4117df083d
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright 2024 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+$(document).ready(function() {
+ $(document).on('click', '.ssnField .fisheye', function() {
+ var type = $(".ssnField").find("input").attr("type");
+ if (type == "text") {
+ $(".ssnField").find("input").attr("type", "password");
+ }
+
+ if (type == "password") {
+ $(".ssnField").find("input").attr("type", "text");
+ }
+ });
+ });
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
new file mode 100644
index 0000000000..7a70e20574
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
@@ -0,0 +1,58 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.js
new file mode 100644
index 0000000000..dc33ea8b81
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.js
@@ -0,0 +1,34 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2024 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+use(function () {
+
+ var clientlibsArr = ['core.forms.components.base.v1.editor'];
+ var labelPath = 'core/fd/components/af-commons/v1/fieldTemplates/label.html';
+ var shortDescriptionPath = "core/fd/components/af-commons/v1/fieldTemplates/shortDescription.html";
+ var longDescriptionPath = "core/fd/components/af-commons/v1/fieldTemplates/longDescription.html";
+ var questionMarkPath = "core/fd/components/af-commons/v1/fieldTemplates/questionMark.html"
+ var errorMessagePath = "core/fd/components/af-commons/v1/fieldTemplates/errorMessage.html";
+
+ return {
+ labelPath: labelPath,
+ shortDescriptionPath: shortDescriptionPath,
+ longDescriptionPath: longDescriptionPath,
+ questionMarkPath: questionMarkPath,
+ errorMessagePath: errorMessagePath,
+ clientlibs: clientlibsArr
+ }
+});
\ No newline at end of file
From fadf21a8145013bee2a862f81e791c319dcef440 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Fri, 23 Feb 2024 15:44:17 +0530
Subject: [PATCH 02/32] AF Password Component| Updated license year and few
code comments block update
---
.../adobe/cq/forms/core/components/models/form/Password.java | 2 +-
.../apps/core/fd/components/form/password/v1/password/README.md | 2 +-
.../form/password/v1/password/clientlibs/editor/js.txt | 2 +-
.../form/password/v1/password/clientlibs/site/css.txt | 2 +-
.../components/form/password/v1/password/clientlibs/site/js.txt | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
index 0f8bea8956..62ee8a5c02 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
@@ -25,7 +25,7 @@ public interface Password extends Field, StringConstraint, NumberConstraint {
* Returns the validation pattern (regex) for the password field.
*
* @return the validation pattern
- * @since com.adobe.cq.forms.core.components.models.form 1.0.0
+ * @since com.adobe.cq.forms.core.components.models.form 2.0.0
*/
String getValidationPattern();
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
index 87d7552110..3deb0fa3dc 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
@@ -1,5 +1,5 @@
-
+ dir="auto" aria-label="password"/>
-
-
\ No newline at end of file
+
\ No newline at end of file
From 2c322eff4806bc1dca780a0e8db5b73d6ecbdbfd Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 4 Mar 2024 12:58:59 +0530
Subject: [PATCH 04/32] AF Password|Test Cases and html updates supporting
responsiveness
---
.../internal/models/v1/form/PasswordImpl.java | 8 +-
.../core/components/models/form/Password.java | 5 +
.../models/v1/form/PasswordImplTest.java | 181 ++++++++++++++++++
.../exporter-password-customized.json | 41 ++++
.../password/exporter-password-datalayer.json | 38 ++++
.../resources/form/password/test-content.json | 121 ++++++++++++
.../site/js/togglepasswordvisibility.js | 4 +-
.../form/password/v1/password/password.html | 30 +--
8 files changed, 409 insertions(+), 19 deletions(-)
create mode 100644 bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
create mode 100644 bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
create mode 100644 bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json
create mode 100644 bundles/af-core/src/test/resources/form/password/test-content.json
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
index b8d2de195e..48aef529db 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -16,11 +16,13 @@
package com.adobe.cq.forms.core.components.internal.models.v1.form;
+import javax.annotation.Nullable;
+
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Exporter;
import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
import com.adobe.cq.export.json.ComponentExporter;
@@ -38,8 +40,8 @@
extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class PasswordImpl extends AbstractFieldImpl implements Password {
- @ValueMapValue
- @Default(values = "")
+ @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
+ @Nullable
private String validationPattern;
@Override
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
index 62ee8a5c02..9d78a1148a 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
@@ -18,6 +18,11 @@
import org.osgi.annotation.versioning.ConsumerType;
+/**
+ * Interface for {@code Password} Sling Model used for the {@code /apps/core/fd/components/form/password/v1/password} component.
+ *
+ * @since com.adobe.cq.forms.core.components.models.form 2.0.0
+ */
@ConsumerType
public interface Password extends Field, StringConstraint, NumberConstraint {
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
new file mode 100644
index 0000000000..01b30e648d
--- /dev/null
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -0,0 +1,181 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Copyright 2024 Adobe
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+package com.adobe.cq.forms.core.components.internal.models.v1.form;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import com.adobe.cq.forms.core.Utils;
+import com.adobe.cq.forms.core.components.datalayer.FormComponentData;
+import com.adobe.cq.forms.core.components.models.form.FieldType;
+import com.adobe.cq.forms.core.components.models.form.Password;
+import com.adobe.cq.forms.core.components.models.form.TextInput;
+import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
+import io.wcm.testing.mock.aem.junit5.AemContext;
+import io.wcm.testing.mock.aem.junit5.AemContextExtension;
+
+import static org.junit.Assert.assertEquals;
+
+@ExtendWith(AemContextExtension.class)
+public class PasswordImplTest {
+
+ private static final String BASE = "/form/password";
+ private static final String CONTENT_ROOT = "/content";
+ private static final String PATH_PASSWORD_DATALAYER = CONTENT_ROOT + "/password-datalayer";
+ private static final String PATH_PASSWORD_CUSTOMIZED = CONTENT_ROOT + "/password-customized";
+
+ private final AemContext context = FormsCoreComponentTestContext.newAemContext();
+
+ @BeforeEach
+ void setUp() {
+ context.load().json(BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
+ }
+
+ @Test
+ void testFieldType() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(FieldType.PASSWORD.getValue(), password.getFieldType());
+ }
+
+ @Test
+ void testGetLabel() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals("pwd", password.getLabel().getValue());
+ }
+
+ @Test
+ void testPlaceholder() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals("Enter valid password", password.getPlaceHolder());
+ }
+
+ @Test
+ void testGetName() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals("password", password.getName());
+
+ }
+
+ @Test
+ void testDorProperties() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(true, password.getDorProperties().get("dorExclusion"));
+ assertEquals("4", password.getDorProperties().get("dorColspan"));
+ assertEquals("Text1", password.getDorProperties().get("dorBindRef"));
+
+ }
+
+ @Test
+ void testGetDescription() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals("password field", password.getDescription());
+ }
+
+ @Test
+ void testGetRequired() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(true, password.isRequired());
+ }
+
+ @Test
+ void testGetValidationPattern() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals("/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/", password.getValidationPattern());
+
+ }
+
+ @Test
+ void testIsEnabled() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(true, password.isEnabled());
+ }
+
+ @Test
+ void testIsEnabledForCustomized() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(true, password.isEnabled());
+ }
+
+ @Test
+ void testIsReadOnly() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(false, password.isReadOnly());
+ }
+
+ @Test
+ void testIsReadOnlyForCustomized() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(false, password.isReadOnly());
+ }
+
+ @Test
+ void testMinLength() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(5, password.getMinLength().intValue());
+ }
+
+ @Test
+ void testMaxLength() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(10, password.getMaxLength().intValue());
+ }
+
+ @Test
+ void testGetExclusiveMinimum() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(8, password.getExclusiveMinimum().intValue());
+ }
+
+ @Test
+ void testGetExclusiveMaximum() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(16, password.getExclusiveMaximum().intValue());
+ }
+
+ @Test
+ void testGetMinimum() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(1, password.getMinimum().intValue());
+ }
+
+ @Test
+ void testGetMaximum() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(6, password.getMaximum().intValue());
+ }
+
+ @Test
+ void testGetDisplayFormat() throws Exception {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals("password", password.getFormat());
+ }
+
+ @Test
+ void testDataLayerProperties() throws IllegalAccessException {
+ TextInput textInput = Utils.getComponentUnderTest(PATH_PASSWORD_DATALAYER, TextInput.class, context);
+ FieldUtils.writeField(textInput, "dataLayerEnabled", true, true);
+ FormComponentData dataObject = (FormComponentData) textInput.getData();
+ assert (dataObject != null);
+ assert (dataObject.getId()).equals("password-1c7bc238a6");
+ assert (dataObject.getType()).equals("core/fd/components/form/password/v1/password");
+ assert (dataObject.getTitle()).equals("Full Name");
+ assert (dataObject.getFieldType()).equals("password");
+ assert (dataObject.getDescription()).equals("Enter Full Name");
+ }
+}
diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
new file mode 100644
index 0000000000..0222bd54e2
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
@@ -0,0 +1,41 @@
+{
+ "id": "password-477c777f4e",
+ "fieldType": "password",
+ "name": "password1708629052628",
+ "visible": true,
+ "description": "long desc
\r\n",
+ "tooltip": "short desc
\r\n",
+ "type": "string",
+ "required": true,
+ "enabled": true,
+ "constraintMessages": {
+ "required": "Password is required",
+ "minLength": "min chars",
+ "maxLength": "max chars",
+ "pattern": "Invalid pwd"
+ },
+ "readOnly": false,
+ "minLength": 5,
+ "maxLength": 10,
+ "validationPattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/",
+ "label": {
+ "value": "Password",
+ "visible": true
+ },
+ "properties": {
+ "afs:layout": {
+ "tooltipVisible": false
+ },
+ "fd:dor": {
+ "dorExclusion": false
+ },
+ "fd:path": "/content/password-customized"
+ },
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "placeholder": "Enter valid password",
+ ":type": "core/fd/components/form/password/v1/password"
+}
\ No newline at end of file
diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json b/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json
new file mode 100644
index 0000000000..ab723a1dd2
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json
@@ -0,0 +1,38 @@
+{
+ "id": "password-1c7bc238a6",
+ "fieldType": "password",
+ "name": "Full Name",
+ "visible": true,
+ "description": "Enter Full Name",
+ "tooltip": "Full Name",
+ "type": "string",
+ "required": true,
+ "enabled": true,
+ "readOnly": false,
+ "label": {
+ "value": "Full Name"
+ },
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "properties": {
+ "afs:layout": {
+ "tooltipVisible": false
+ },
+ "fd:dor": {
+ "dorExclusion": false
+ },
+ "fd:path": "/content/password-datalayer"
+ },
+ ":type": "core/fd/components/form/password/v1/password",
+ "dataLayer": {
+ "password-1c7bc238a6": {
+ "dc:title": "Full Name",
+ "dc:description": "Enter Full Name",
+ "@type": "core/fd/components/form/password/v1/password",
+ "fieldType": "password"
+ }
+ }
+}
\ No newline at end of file
diff --git a/bundles/af-core/src/test/resources/form/password/test-content.json b/bundles/af-core/src/test/resources/form/password/test-content.json
new file mode 100644
index 0000000000..31c2c2f1e2
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/password/test-content.json
@@ -0,0 +1,121 @@
+{
+ "password" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "fieldType": "password"
+ },
+ "password-customized" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "password",
+ "jcr:title" : "pwd",
+ "hideTitle" : false,
+ "dorExclusion": true,
+ "dorColspan": "4",
+ "dorBindRef": "Text1",
+ "description" : "password field",
+ "visible" : false,
+ "readOnly": false,
+ "enabled": true,
+ "required": true,
+ "minLength": 5,
+ "maxLength": 10,
+ "maximum" : 6,
+ "minimum" : 1,
+ "exclusiveMinimum":8,
+ "exclusiveMaximum":16,
+ "displayFormat" : "password",
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "placeholder": "Enter valid password",
+ "validationPattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/",
+ "default" : "password",
+ "fieldType": "password",
+ "label": {
+ "value": "Password",
+ "visible": true
+ }
+ },
+ "password-format" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "hideTitle" : false,
+ "description" : "dummy",
+ "visible" : false,
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "default" : "abc",
+ "fieldType": "password",
+ "readOnly": false,
+ "enabled": true,
+ "displayFormat" : "password"
+ },
+ "password-datalayer" : {
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "id": "password-1c7bc238a6",
+ "fieldType": "password",
+ "name": "Full Name",
+ "jcr:title" : "Full Name",
+ "visible": true,
+ "description": "Enter Full Name",
+ "tooltip": "Full Name",
+ "type": "string",
+ "required": true,
+ "enabled": true,
+ "readOnly": false,
+ "label": {
+ "value": "Full Name"
+ },
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "properties": {
+ "afs:layout": {
+ "tooltipVisible": false
+ },
+ "fd:dor": {
+ "dorExclusion": false
+ },
+ "fd:path": "/content/forms/af/af2/jcr:content/guideContainer/password"
+ },
+ ":type": "forms-components-examples/components/form/password"
+ },
+ "password_unboundFormElement" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "fieldType": "password",
+ "unboundFormElement": true,
+ "dataRef": "$.h"
+ },
+ "password-blank-dataref" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "fieldType": "password",
+ "dataRef": ""
+ },
+ "password-blank-validationExpression" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "fieldType": "password",
+ "validationExpression": ""
+ }
+ }
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
index 7b8e434f79..cdbb748860 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -15,8 +15,8 @@
******************************************************************************/
(function() {
"use strict";
- let togglePasswordButton = document.querySelector('.cmp-adaptiveform-password .fisheye');
- let passwordInput = document.querySelector('input.cmp-adaptiveform-password__widget');
+ const togglePasswordButton = document.querySelector('.cmp-adaptiveform-password__input-wrapper .eyeicon');
+ const passwordInput = document.querySelector('.cmp-adaptiveform-password__input-wrapper input.cmp-adaptiveform-password__widget');
if(togglePasswordButton && passwordInput){
togglePasswordButton.addEventListener('click', function () {
if (passwordInput.type === 'password') {
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
index d237c078f2..612bbe648f 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
@@ -35,20 +35,22 @@
-
-
+
+
+
+
From 390a3fd5a7c4eccb389f9fac7814fbbd076a3133 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 4 Mar 2024 17:32:22 +0530
Subject: [PATCH 05/32] AF Password| Test case updates
---
.../internal/models/v1/form/PasswordImplTest.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
index 01b30e648d..2ccc2f4803 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -25,7 +25,6 @@
import com.adobe.cq.forms.core.components.datalayer.FormComponentData;
import com.adobe.cq.forms.core.components.models.form.FieldType;
import com.adobe.cq.forms.core.components.models.form.Password;
-import com.adobe.cq.forms.core.components.models.form.TextInput;
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
@@ -168,9 +167,9 @@ void testGetDisplayFormat() throws Exception {
@Test
void testDataLayerProperties() throws IllegalAccessException {
- TextInput textInput = Utils.getComponentUnderTest(PATH_PASSWORD_DATALAYER, TextInput.class, context);
- FieldUtils.writeField(textInput, "dataLayerEnabled", true, true);
- FormComponentData dataObject = (FormComponentData) textInput.getData();
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_DATALAYER, Password.class, context);
+ FieldUtils.writeField(password, "dataLayerEnabled", true, true);
+ FormComponentData dataObject = (FormComponentData) password.getData();
assert (dataObject != null);
assert (dataObject.getId()).equals("password-1c7bc238a6");
assert (dataObject.getType()).equals("core/fd/components/form/password/v1/password");
From eb470c31dd7b237955e8e0846dff54d32568269b Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 11 Mar 2024 19:29:30 +0530
Subject: [PATCH 06/32] AF Password | PR review comments Updates
---
.../form/password/v1/password/.content.xml | 4 +--
.../form/password/v1/password/README.md | 9 +++---
.../password/_cq_design_dialog/.content.xml | 32 ++-----------------
.../v1/password/_cq_dialog/.content.xml | 4 ++-
.../clientlibs/site/css/passwordview.css | 31 +++++++++++++++++-
.../v1/password/clientlibs/site/js.txt | 1 -
.../clientlibs/site/js/passwordview.js | 22 ++++++++++++-
.../site/js/togglepasswordvisibility.js | 29 -----------------
.../form/password/v1/password/password.html | 2 +-
9 files changed, 64 insertions(+), 70 deletions(-)
delete mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/.content.xml
index b568963358..a2530d42b7 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/.content.xml
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
index b63ed7380a..786f295810 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
@@ -35,7 +35,9 @@
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Default value"
name="./default"
- wrapperClass="cmp-adaptiveform-password__value"/>
+ sling:hideResource="{Boolean}true"
+ wrapperClass="cmp-adaptiveform-password__value"/>
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
index 229055b840..92944601bf 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
@@ -12,4 +12,33 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- ******************************************************************************/
\ No newline at end of file
+ ******************************************************************************/
+
+ .cmp-adaptiveform-password {
+
+ }
+
+ .cmp-adaptiveform-password__widget {
+
+ }
+ textarea.cmp-adaptiveform-password__widget{
+
+ }
+
+ .cmp-adaptiveform-password__label {
+
+ }
+ .cmp-adaptiveform-password__label-container{
+
+ }
+
+ .cmp-adaptiveform-password__longdescription {
+ }
+
+ .cmp-adaptiveform-password__shortdescription {
+ }
+
+ .cmp-adaptiveform-password__questionmark {
+
+ }
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
index 2d87664496..12d384898e 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
@@ -16,4 +16,3 @@
#base=js
passwordview.js
-togglepasswordvisibility.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
index 40fcd8cf56..8551120ca8 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
@@ -34,7 +34,8 @@
description: `.${Password.bemBlock}__longdescription`,
qm: `.${Password.bemBlock}__questionmark`,
errorDiv: `.${Password.bemBlock}__errormessage`,
- tooltipDiv: `.${Password.bemBlock}__shortdescription`
+ tooltipDiv: `.${Password.bemBlock}__shortdescription`,
+ eyeIcon: `.${Password.bemBlock}__eyeicon`
};
constructor(params) {
@@ -65,6 +66,10 @@
return this.element.querySelector(Password.selectors.qm);
}
+ getEyeIcon(){
+ return this.element.querySelector(Password.selectors.eyeIcon);
+ }
+
setModel(model) {
super.setModel(model);
if (this.widget.value !== '') {
@@ -77,7 +82,22 @@
this.widget.addEventListener('focus', (e) => {
this.setActive();
});
+ this.getEyeIcon().addEventListener('click', (e) => {
+ this.#togglePasswordType();
+ });
}
+
+ #togglePasswordType(){
+ const widget = this.getWidget();
+ if(widget.value){
+ const widget = this.getWidget();
+ if (widget.type === FormView.Constants.HTML_INPUT_TYPE_PASSWORD) {
+ widget.type = FormView.Constants.HTML_INPUT_TYPE_TEXT;
+ } else {
+ widget.type = FormView.Constants.HTML_INPUT_TYPE_PASSWORD;
+ }
+ }
+ }
}
FormView.Utils.setupField(({element, formContainer}) => {
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
deleted file mode 100644
index cdbb748860..0000000000
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright 2024 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-(function() {
- "use strict";
- const togglePasswordButton = document.querySelector('.cmp-adaptiveform-password__input-wrapper .eyeicon');
- const passwordInput = document.querySelector('.cmp-adaptiveform-password__input-wrapper input.cmp-adaptiveform-password__widget');
- if(togglePasswordButton && passwordInput){
- togglePasswordButton.addEventListener('click', function () {
- if (passwordInput.type === 'password') {
- passwordInput.type = 'text';
- } else {
- passwordInput.type = 'password';
- }
- });
- }
- })();
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
index 612bbe648f..21f798bd59 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
@@ -49,7 +49,7 @@
pattern="${password.validationPattern}"
dir="auto"
aria-label="password" />
-
+
From ab5b4e7c662c1cace543e1c09cc899f0f2b35c42 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 18 Mar 2024 13:02:10 +0530
Subject: [PATCH 07/32] AF Password| Cypress test cases for editor and runtime
JS
---
.../adaptive-form/password/.content.xml | 221 +++++++++++++++++
.../samples/password/.content.xml | 6 +
.../samples/password/basic/.content.xml | 23 ++
.../samples/password/.content.xml | 3 +
.../samples/password/basic/.content.xml | 234 ++++++++++++++++++
.../libs/commons/formsConstants.js | 1 +
.../specs/password/password.authoring.spec.js | 177 +++++++++++++
.../specs/password/password.runtime.spec.js | 162 ++++++++++++
8 files changed, 827 insertions(+)
create mode 100644 examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
create mode 100644 it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/password/.content.xml
create mode 100644 it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/password/basic/.content.xml
create mode 100644 it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/password/.content.xml
create mode 100644 it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/password/basic/.content.xml
create mode 100644 ui.tests/test-module/specs/password/password.authoring.spec.js
create mode 100644 ui.tests/test-module/specs/password/password.runtime.spec.js
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
new file mode 100644
index 0000000000..0237cad9c1
--- /dev/null
+++ b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
@@ -0,0 +1,221 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/password/.content.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/password/.content.xml
new file mode 100644
index 0000000000..d738d26849
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/password/.content.xml
@@ -0,0 +1,6 @@
+
+
diff --git a/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/password/basic/.content.xml b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/password/basic/.content.xml
new file mode 100644
index 0000000000..ef1113d23c
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/dam/formsanddocuments/core-components-it/samples/password/basic/.content.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/password/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/password/.content.xml
new file mode 100644
index 0000000000..a0ac99e384
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/password/.content.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/password/basic/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/password/basic/.content.xml
new file mode 100644
index 0000000000..d86fa760a4
--- /dev/null
+++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/password/basic/.content.xml
@@ -0,0 +1,234 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui.tests/test-module/libs/commons/formsConstants.js b/ui.tests/test-module/libs/commons/formsConstants.js
index c511260f7a..cf2e1992fa 100644
--- a/ui.tests/test-module/libs/commons/formsConstants.js
+++ b/ui.tests/test-module/libs/commons/formsConstants.js
@@ -50,6 +50,7 @@ var formsConstants = {
"termsandconditions": "/apps/forms-components-examples/components/form/termsandconditions",
"submitButton": "/apps/forms-components-examples/components/form/actions/submit",
"review": "/apps/forms-components-examples/components/form/review",
+ "password": "/apps/forms-components-examples/components/form/password"
}
},
resourceType : {
diff --git a/ui.tests/test-module/specs/password/password.authoring.spec.js b/ui.tests/test-module/specs/password/password.authoring.spec.js
new file mode 100644
index 0000000000..e35344b029
--- /dev/null
+++ b/ui.tests/test-module/specs/password/password.authoring.spec.js
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2024 Adobe Systems Incorporated
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const sitesSelectors = require('../../libs/commons/sitesSelectors'),
+ afConstants = require('../../libs/commons/formsConstants');
+
+/**
+ * Testing Password with Sites Editor
+ */
+describe('Page - Authoring', function () {
+ // we can use these values to log in
+
+ const dropPasswordInContainer = function () {
+ const dataPath = "/content/forms/af/core-components-it/blank/jcr:content/guideContainer/*",
+ responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-path='" + dataPath + "']";
+ cy.selectLayer("Edit");
+ cy.insertComponent(responsiveGridDropZoneSelector, "Adaptive Form Password Box", afConstants.components.forms.resourceType.password);
+ cy.get('body').click(0, 0);
+ }
+
+ const dropPasswordInSites = function () {
+ const dataPath = "/content/core-components-examples/library/adaptive-form/password/jcr:content/root/responsivegrid/demo/component/guideContainer/*",
+ responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-path='" + dataPath + "']";
+ cy.selectLayer("Edit");
+ cy.insertComponent(responsiveGridDropZoneSelector, "Adaptive Form Password Box", afConstants.components.forms.resourceType.password);
+ cy.get('body').click(0, 0);
+ }
+
+ const testPasswordBehaviour = function (passwordEditPathSelector, passwordDrop, isSites) {
+ if (isSites) {
+ dropPasswordInSites();
+ } else {
+ dropPasswordInContainer();
+ }
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + passwordEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+
+ // Checking some dynamic behaviours
+ cy.get(".cmp-adaptiveform-password__maxlength").invoke('css', 'display').should('equal', 'block');
+ cy.get(".cmp-adaptiveform-password__minlength").invoke('css', 'display').should('equal', 'block');
+ cy.get(".cmp-adaptiveform-base__placeholder").parent('div').invoke('css', 'display').should('equal', 'block');
+ cy.get('.cmp-adaptiveform-password__editdialog').contains('Validation').click({force: true}).then(() => {
+ cy.get("[name='./validationPattern']").should('have.length', 1);
+ cy.get("[name='./validatePictureClauseMessage']").should('have.length', 1);
+ cy.get('.cq-dialog-cancel').click();
+ cy.deleteComponentByPath(passwordDrop);
+ })
+ }
+
+ const testCopyPasteComponent = function (passwordEditPathSelector, passwordEditPathSelectorCopy, passwordDrop) {
+ dropPasswordInContainer();
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + passwordEditPathSelector);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+ // Check If Dialog Options Are Visible
+ cy.get(".cmp-adaptiveform-base__editdialogbasic input[name='./name']")
+ .should("exist")
+ .should("be.visible");
+ cy.get(".cmp-adaptiveform-base__editdialogbasic input[name='./name']").focus().clear();
+ cy.get(".cmp-adaptiveform-base__editdialogbasic input[name='./name']").invoke('val', 'Password');
+ cy.get(".cmp-adaptiveform-base__editdialogbasic input[name='./name']").focus().type("{enter}");
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + passwordEditPathSelector);
+ cy.invokeEditableAction("[data-action='COPY']");
+ const dataPath = "/content/forms/af/core-components-it/blank/jcr:content/guideContainer/*",
+ responsiveGridDropZoneSelector = sitesSelectors.overlays.overlay.component + "[data-path='" + dataPath + "']";
+ cy.openEditableToolbar(responsiveGridDropZoneSelector);
+ cy.invokeEditableAction("[data-action='PASTE']");
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + passwordEditPathSelectorCopy);
+ cy.invokeEditableAction("[data-action='CONFIGURE']"); // this line is causing frame busting which is causing cypress to fail
+ // Check If Dialog Options Are Visible
+ cy.get(".cmp-adaptiveform-base__editdialogbasic [name='./name']")
+ .should("exist")
+ .should("have.value", "password_copy_1");
+ cy.get("coral-dialog.is-open coral-dialog-footer button[variant='default']").click();
+ cy.deleteComponentByPath(passwordDrop);
+ cy.deleteComponentByPath(passwordDrop + "_copy");
+ }
+
+ const getRuleEditorIframe = () => {
+ // get the iframe > document > body
+ // and retry until the body element is not empty
+ return cy
+ .get('iframe#af-rule-editor')
+ .its('0.contentDocument.body').should('not.be.empty')
+ .then(cy.wrap)
+ }
+
+ context('Open Forms Editor', function () {
+ const pagePath = "/content/forms/af/core-components-it/blank",
+ passwordEditPath = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/password",
+ passwordEditPathSelector = "[data-path='" + passwordEditPath + "']",
+ passwordEditPathSelectorCopy = "[data-path='" + passwordEditPath + "_copy']",
+ passwordDrop = pagePath + afConstants.FORM_EDITOR_FORM_CONTAINER_SUFFIX + "/" + afConstants.components.forms.resourceType.password.split("/").pop();
+ beforeEach(function () {
+ // this is done since cypress session results in 403 sometimes
+ cy.openAuthoring(pagePath);
+ });
+
+ it('insert Password in form container', function () {
+ dropPasswordInContainer();
+ cy.deleteComponentByPath(passwordDrop);
+ });
+
+ it('open edit dialog of Password', function () {
+ testPasswordBehaviour(passwordEditPathSelector, passwordDrop);
+ })
+
+ it.skip('pasted component should have unique name', function () {
+ testCopyPasteComponent(passwordEditPathSelector, passwordEditPathSelectorCopy, passwordDrop);
+ })
+ })
+
+ context('Open Sites Editor', function () {
+ const pagePath = "/content/core-components-examples/library/adaptive-form/password",
+ passwordEditPath = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + "/guideContainer/password",
+ passwordInsideSitesContainerEditPath = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + "/guideContainer/container/password_demo",
+ passwordEditPathSelector = "[data-path='" + passwordEditPath + "']",
+ passwordInsideSitesContainerEditPathSelector = "[data-path='" + passwordInsideSitesContainerEditPath + "']",
+ passwordDrop = pagePath + afConstants.RESPONSIVE_GRID_DEMO_SUFFIX + '/guideContainer/' + afConstants.components.forms.resourceType.password.split("/").pop();
+
+ beforeEach(function () {
+ cy.openAuthoring(pagePath);
+ });
+
+ it('insert aem forms Password', function () {
+ dropPasswordInSites();
+ cy.deleteComponentByPath(passwordDrop);
+ });
+
+ it('open edit dialog of aem forms Password', function() {
+ testPasswordBehaviour(passwordEditPathSelector, passwordDrop, true);
+ });
+
+ it('Test z-index of Rule editor iframe', function () {
+ dropPasswordInSites();
+ cy.openSidePanelTab("Content Tree");
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + passwordEditPathSelector);
+ cy.invokeEditableAction("[data-action='editexpression']");
+ cy.get("#af-rule-editor").should("be.visible");
+ cy.get("#af-rule-editor")
+ .invoke("css", "z-index")
+ .should("equal", '10');
+ getRuleEditorIframe().find("#objectNavigationTree").should("be.visible");
+ getRuleEditorIframe().find("#create-rule-button").should("be.visible");
+ cy.wait(1000)
+ getRuleEditorIframe().find(".exp-Close-Button").should("be.visible").click();
+ cy.deleteComponentByPath(passwordDrop);
+ });
+
+ it('Test z-index of Rule editor iframe for components inside site container', function () {
+ cy.openSidePanelTab("Content Tree");
+ cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + passwordInsideSitesContainerEditPathSelector);
+ cy.invokeEditableAction("[data-action='editexpression']");
+ cy.get("#af-rule-editor").should("be.visible");
+ cy.get("#af-rule-editor")
+ .invoke("css", "z-index")
+ .should("equal", '10');
+ getRuleEditorIframe().find("#objectNavigationTree").should("be.visible");
+ getRuleEditorIframe().find("#objectNavigationTree " + passwordInsideSitesContainerEditPathSelector).should("be.visible");
+ getRuleEditorIframe().find("#create-rule-button").should("be.visible");
+ cy.wait(1000);
+ getRuleEditorIframe().find(".exp-Close-Button").should("be.visible").click();
+ });
+ });
+});
diff --git a/ui.tests/test-module/specs/password/password.runtime.spec.js b/ui.tests/test-module/specs/password/password.runtime.spec.js
new file mode 100644
index 0000000000..236da69a6a
--- /dev/null
+++ b/ui.tests/test-module/specs/password/password.runtime.spec.js
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright 2024 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+describe("Form Runtime with Password", () => {
+
+ before(() => {
+ cy.attachConsoleErrorSpy();
+ });
+
+ const pagePath = "content/forms/af/core-components-it/samples/password/basic.html"
+ const bemBlock = 'cmp-adaptiveform-password'
+ const IS = "adaptiveFormPassword"
+ const selectors = {
+ password : `[data-cmp-is="${IS}"]`
+ }
+
+ let formContainer = null;
+
+ /**
+ * initialization of form container before every test
+ * */
+ beforeEach(() => {
+ cy.previewForm(pagePath).then(p => {
+ formContainer = p;
+ });
+ });
+ const checkHTML = (id, state) => {
+ const visible = state.visible;
+ const passVisibleCheck = `${visible === true ? "" : "not."}be.visible`;
+ const passDisabledAttributeCheck = `${state.enabled === false ? "" : "not."}have.attr`;
+ const value = state.value == null ? '' : state.value;
+ cy.get(`#${id}`)
+ .should(passVisibleCheck)
+ .invoke('attr', 'data-cmp-visible')
+ .should('eq', visible.toString());
+ cy.get(`#${id}`)
+ .invoke('attr', 'data-cmp-enabled')
+ .should('eq', state.enabled.toString());
+ return cy.get(`#${id}`).within((root) => {
+ cy.get('*').should(passVisibleCheck)
+ cy.get('input')
+ .should(passDisabledAttributeCheck, 'disabled');
+ cy.get('input').should('have.value', value)
+ });
+ }
+
+ it(" should get model and view initialized properly ", () => {
+ expect(formContainer, "formcontainer is initialized").to.not.be.null;
+ expect(formContainer._model.items.length, "model and view elements match").to.equal(Object.keys(formContainer._fields).length);
+ Object.entries(formContainer._fields).forEach(([id, field]) => {
+ if(field.options.visible === "true") {
+ expect(field.getId()).to.equal(id)
+ expect(formContainer._model.getElement(id), `model and view are in sync`).to.equal(field.getModel())
+ checkHTML(id, field.getModel().getState())
+ }
+ });
+ cy.expectNoConsoleErrors();
+ })
+
+ it(" model's changes are reflected in the html ", () => {
+ const [id, passwordfieldView] = Object.entries(formContainer._fields)[0]
+ const model = formContainer._model.getElement(id)
+ model.value = "some other value"
+ checkHTML(model.id, model.getState()).then(() => {
+ model.visible = false
+ return checkHTML(model.id, model.getState())
+ }).then(() => {
+ model.enabled = false
+ return checkHTML(model.id, model.getState())
+ })
+ cy.expectNoConsoleErrors();
+ });
+
+ it(" html changes are reflected in model ", () => {
+ const [id, password1fieldView] = Object.entries(formContainer._fields)[0]
+ const model = formContainer._model.getElement(id)
+ const input = "value"
+ cy.get(`#${id}`).find("input").clear().type(input).blur().then(x => {
+ expect(model.getState().value).to.equal(input)
+ })
+ cy.expectNoConsoleErrors();
+ });
+
+ it("should toggle description and tooltip", () => {
+ cy.toggleDescriptionTooltip(bemBlock, 'tooltip_scenario_test');
+ })
+
+ it("should show and hide other fields on a certain input", () => {
+ // Rule on passwordbox1: When passwordbox1 has input "Adobe@123" => Show passwordbox3 and Hide passwordbox2
+
+ const [passwordbox1, passwordbox1FieldView] = Object.entries(formContainer._fields)[0];
+ const [passwordbox2, passwordbox2FieldView] = Object.entries(formContainer._fields)[1];
+ const [passwordbox3, passwordbox3FieldView] = Object.entries(formContainer._fields)[2];
+ const input = "Adobe@123";
+
+ cy.get(`#${passwordbox1}`).find("input").clear().type(input).blur().then(x => {
+ cy.get(`#${passwordbox3}`).should('be.visible')
+ cy.get(`#${passwordbox2}`).should('not.be.visible')
+ })
+ cy.expectNoConsoleErrors();
+ })
+
+ it("should enable and disable other textfields on a certain string input", () => {
+ // Rule on passwordbox1: When passwordbox1 has input "Aem@123" => Enable passwordbox2 and Disable passwordbox4
+
+ const [passwordbox1, passwordbox1FieldView] = Object.entries(formContainer._fields)[0];
+ const [passwordbox2, passwordbox2FieldView] = Object.entries(formContainer._fields)[1];
+ const [passwordbox4, passwordbox4FieldView] = Object.entries(formContainer._fields)[3];
+ const input = "Aem@123";
+
+ cy.get(`#${passwordbox1}`).find("input").clear().type(input).blur().then(x => {
+ cy.get(`#${passwordbox2}`).find("input").should('be.enabled')
+ cy.get(`#${passwordbox4}`).find("input").should('not.be.enabled')
+ })
+ cy.expectNoConsoleErrors();
+ })
+
+ it("should set and clear value based on rules", () => {
+ // Rule on passwordbox5: When input of passwordbox5 is "Aemforms@123", set value of passwordbox1 to "new password" and clear value of passwordbox4
+
+ const [passwordbox1, passwordbox1FieldView] = Object.entries(formContainer._fields)[0];
+ const [passwordbox4, passwordbox4FieldView] = Object.entries(formContainer._fields)[3];
+ const [passwordbox5, passwordbox5FieldView] = Object.entries(formContainer._fields)[4];
+
+ const input = "Aemforms@123";
+ // cy.get(`#${passwordbox4}`).find("input").clear().type("this must be cleared")
+ cy.get(`#${passwordbox5}`).find("input").clear().type(input).blur().then(x => {
+ cy.get(`#${passwordbox4}`).find("input").should('have.value',"")
+ cy.get(`#${passwordbox1}`).find("input").should('have.value', "new password")
+ })
+ cy.expectNoConsoleErrors();
+ })
+
+ it("should show required error message on blur when field is empty", () =>{
+ const [passwordbox6, passwordbox6FieldView] = Object.entries(formContainer._fields)[5];
+ cy.get(`#${passwordbox6}`).find("input").clear().focus().blur().then(x => {
+ cy.get(`#${passwordbox6}`).find(".cmp-adaptiveform-password__errormessage").should('have.text',"Please fill in this field.")
+ })
+ })
+
+ it("decoration element should not have same class name", () => {
+ expect(formContainer, "formcontainer is initialized").to.not.be.null;
+ cy.wrap().then(() => {
+ const id = formContainer._model._children[0].id;
+ cy.get(`#${id}`).parent().should("not.have.class", "cmp-adaptiveform-password");
+ })
+
+ })
+})
+
From 400da15a801ae0164b44048e3781df3afd90821f Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Sat, 27 Apr 2024 21:44:26 +0530
Subject: [PATCH 08/32] AF-Password|PR Comments| Removed Constants from
FormConstants to direct values on view
---
.../v1/password/clientlibs/site/css/passwordview.css | 2 +-
.../password/v1/password/clientlibs/site/js/passwordview.js | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
index 92944601bf..29293adc97 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
@@ -21,7 +21,7 @@
.cmp-adaptiveform-password__widget {
}
- textarea.cmp-adaptiveform-password__widget{
+ .cmp-adaptiveform-password__widget{
}
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
index 8551120ca8..966dd5f42b 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
@@ -91,10 +91,10 @@
const widget = this.getWidget();
if(widget.value){
const widget = this.getWidget();
- if (widget.type === FormView.Constants.HTML_INPUT_TYPE_PASSWORD) {
- widget.type = FormView.Constants.HTML_INPUT_TYPE_TEXT;
+ if (widget.type === "password") {
+ widget.type = "text";
} else {
- widget.type = FormView.Constants.HTML_INPUT_TYPE_PASSWORD;
+ widget.type = "password";
}
}
}
From 57c8c098ced8b013575e69f58abcbb9656ee2238 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Wed, 5 Jun 2024 12:42:24 +0530
Subject: [PATCH 09/32] AF-password||Resolved test cases and password java for
exclusive max and min values update
---
.../internal/models/v1/form/PasswordImpl.java | 34 ++++++++++----
.../models/v1/form/PasswordImplTest.java | 21 +++++----
.../exporter-password-customized.json | 4 ++
.../resources/form/password/test-content.json | 44 +++++++++++++++++--
4 files changed, 83 insertions(+), 20 deletions(-)
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
index 48aef529db..d6588b987d 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -17,6 +17,7 @@
package com.adobe.cq.forms.core.components.internal.models.v1.form;
import javax.annotation.Nullable;
+import javax.annotation.PostConstruct;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
@@ -30,6 +31,7 @@
import com.adobe.cq.forms.core.components.internal.form.FormConstants;
import com.adobe.cq.forms.core.components.models.form.Password;
import com.adobe.cq.forms.core.components.util.AbstractFieldImpl;
+import com.adobe.cq.forms.core.components.util.ComponentUtils;
@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
@@ -40,6 +42,9 @@
extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class PasswordImpl extends AbstractFieldImpl implements Password {
+ private Object exclusiveMinimumVaue;
+ private Object exclusiveMaximumValue;
+
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@Nullable
private String validationPattern;
@@ -70,23 +75,36 @@ public Long getMaximum() {
}
@Override
- public Long getExclusiveMaximum() {
- return exclusiveMaximum;
+ public String getFormat() {
+ return displayFormat;
}
@Override
- public Long getExclusiveMinimum() {
- return exclusiveMinimum;
+ public String getValidationPattern() {
+ return validationPattern;
}
@Override
- public String getFormat() {
- return displayFormat;
+ public Long getExclusiveMaximum() {
+ return (Long) exclusiveMaximumValue;
}
@Override
- public String getValidationPattern() {
- return validationPattern;
+ public Long getExclusiveMinimum() {
+ return (Long) exclusiveMinimumVaue;
+ }
+
+ @PostConstruct
+ private void initTextInput() {
+ exclusiveMaximumValue = ComponentUtils.getExclusiveValue(exclusiveMaximum, maximum, null);
+ exclusiveMinimumVaue = ComponentUtils.getExclusiveValue(exclusiveMinimum, minimum, null);
+ // in json either, exclusiveMaximum or maximum should be present
+ if (exclusiveMaximumValue != null) {
+ maximum = null;
+ }
+ if (exclusiveMinimumVaue != null) {
+ minimum = null;
+ }
}
}
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
index 2ccc2f4803..cf75eed440 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -30,6 +30,7 @@
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
@ExtendWith(AemContextExtension.class)
public class PasswordImplTest {
@@ -38,6 +39,8 @@ public class PasswordImplTest {
private static final String CONTENT_ROOT = "/content";
private static final String PATH_PASSWORD_DATALAYER = CONTENT_ROOT + "/password-datalayer";
private static final String PATH_PASSWORD_CUSTOMIZED = CONTENT_ROOT + "/password-customized";
+ private static final String PATH_NUMBER_PASSWORD_EXCLUSIVE = CONTENT_ROOT + "/number-password-exclusive";
+ private static final String PATH_NUMBER_PASSWORD_INPUT = CONTENT_ROOT + "/number-password";
private final AemContext context = FormsCoreComponentTestContext.newAemContext();
@@ -137,26 +140,28 @@ void testMaxLength() {
@Test
void testGetExclusiveMinimum() {
- Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
- assertEquals(8, password.getExclusiveMinimum().intValue());
+ Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_EXCLUSIVE, Password.class, context);
+ assertNull(password.getMinimum());
+ assertEquals(8L, password.getExclusiveMinimum().longValue());
}
@Test
void testGetExclusiveMaximum() {
- Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
- assertEquals(16, password.getExclusiveMaximum().intValue());
+ Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_EXCLUSIVE, Password.class, context);
+ assertNull(password.getMaximum());
+ assertEquals(16L, password.getExclusiveMaximum().longValue());
}
@Test
void testGetMinimum() {
- Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
- assertEquals(1, password.getMinimum().intValue());
+ Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_INPUT, Password.class, context);
+ assertEquals(8, password.getMinimum().intValue());
}
@Test
void testGetMaximum() {
- Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
- assertEquals(6, password.getMaximum().intValue());
+ Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_INPUT, Password.class, context);
+ assertEquals(16, password.getMaximum().intValue());
}
@Test
diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
index 0222bd54e2..02bd02f46b 100644
--- a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
+++ b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
@@ -17,6 +17,10 @@
"readOnly": false,
"minLength": 5,
"maxLength": 10,
+ "maximum" : 16,
+ "minimum" : 1,
+ "exclusiveMinimum" : 8,
+ "exclusiveMaximum" : 16,
"validationPattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/",
"label": {
"value": "Password",
diff --git a/bundles/af-core/src/test/resources/form/password/test-content.json b/bundles/af-core/src/test/resources/form/password/test-content.json
index 31c2c2f1e2..10748c1807 100644
--- a/bundles/af-core/src/test/resources/form/password/test-content.json
+++ b/bundles/af-core/src/test/resources/form/password/test-content.json
@@ -22,10 +22,6 @@
"required": true,
"minLength": 5,
"maxLength": 10,
- "maximum" : 6,
- "minimum" : 1,
- "exclusiveMinimum":8,
- "exclusiveMaximum":16,
"displayFormat" : "password",
"assistPriority" : "custom",
"dataRef" : "a.b",
@@ -41,6 +37,46 @@
"visible": true
}
},
+ "number-password" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/textinput/v1/textinput",
+ "name" : "abc",
+ "type" : "password",
+ "jcr:title" : "def",
+ "hideTitle" : false,
+ "description" : "dummy",
+ "visible" : false,
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "fieldType": "text-input",
+ "maximum" : 16,
+ "minimum" : 8,
+ "default" : 150
+ },
+ "number-password-exclusive" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "type" : "password",
+ "jcr:title" : "def",
+ "hideTitle" : false,
+ "description" : "dummy",
+ "visible" : false,
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "fieldType": "text-input",
+ "maximum" : 16,
+ "minimum" : 8,
+ "exclusiveMinimum" : true,
+ "exclusiveMaximum" : true,
+ "default" : 150
+ },
"password-format" : {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType" : "core/fd/components/form/password/v1/password",
From 0da36aef95fb1b5b05ceed8c43b934a2eea5ddb2 Mon Sep 17 00:00:00 2001
From: Rishi Mehta <69448117+rismehta@users.noreply.github.com>
Date: Thu, 11 Jul 2024 09:25:52 +0530
Subject: [PATCH 10/32] Fixing flaky test (#1312)
* Fixing flaky test
* updating quickstart docker
* Fixing flaky test
---
.../internal/form/FormConstants.java | 1 +
.../internal/models/v1/form/PasswordImpl.java | 28 +++-------------
.../core/components/models/form/Password.java | 32 +++++++------------
.../v1/password/_cq_dialog/.content.xml | 3 +-
.../clientlibs/site/css/passwordview.css | 2 +-
.../v1/password/clientlibs/site/js.txt | 1 +
.../site/js/togglepasswordvisibility.js | 28 ++++++++++++++++
.../form/password/v1/password/password.html | 2 +-
8 files changed, 49 insertions(+), 48 deletions(-)
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
index 44126e8b8f..e835534436 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
@@ -142,5 +142,6 @@ private FormConstants() {
/* The resource type for the pre-selected the linked panel */
public final static String RT_FD_FORM_REVIEW_DATASOURCE_V1 = RT_FD_FORM_PREFIX + "review/v1/datasource";
+
public static final String RT_FD_FORM_PASSWORD_V1 = RT_FD_FORM_PREFIX + "password/v1/password";
}
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
index d6588b987d..47a52102dd 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -47,7 +47,7 @@ public class PasswordImpl extends AbstractFieldImpl implements Password {
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@Nullable
- private String validationPattern;
+ private String pattern;
@Override
public String getFieldType() {
@@ -64,38 +64,18 @@ public Integer getMaxLength() {
return maxLength;
}
- @Override
- public Long getMinimum() {
- return minimum;
- }
-
- @Override
- public Long getMaximum() {
- return maximum;
- }
-
@Override
public String getFormat() {
return displayFormat;
}
@Override
- public String getValidationPattern() {
- return validationPattern;
- }
-
- @Override
- public Long getExclusiveMaximum() {
- return (Long) exclusiveMaximumValue;
- }
-
- @Override
- public Long getExclusiveMinimum() {
- return (Long) exclusiveMinimumVaue;
+ public String getPattern() {
+ return pattern;
}
@PostConstruct
- private void initTextInput() {
+ private void initPassword() {
exclusiveMaximumValue = ComponentUtils.getExclusiveValue(exclusiveMaximum, maximum, null);
exclusiveMinimumVaue = ComponentUtils.getExclusiveValue(exclusiveMinimum, minimum, null);
// in json either, exclusiveMaximum or maximum should be present
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
index 9d78a1148a..89f55e38b1 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
@@ -14,24 +14,16 @@
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package com.adobe.cq.forms.core.components.models.form;
+ package com.adobe.cq.forms.core.components.models.form;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Interface for {@code Password} Sling Model used for the {@code /apps/core/fd/components/form/password/v1/password} component.
- *
- * @since com.adobe.cq.forms.core.components.models.form 2.0.0
- */
-@ConsumerType
-public interface Password extends Field, StringConstraint, NumberConstraint {
-
- /**
- * Returns the validation pattern (regex) for the password field.
- *
- * @return the validation pattern
- * @since com.adobe.cq.forms.core.components.models.form 2.0.0
- */
- String getValidationPattern();
-
-}
+ import org.osgi.annotation.versioning.ConsumerType;
+
+ /**
+ * Interface for {@code Password} Sling Model used for the {@code /apps/core/fd/components/form/password/v1/password} component.
+ *
+ * @since com.adobe.cq.forms.core.components.models.form 5.11.0
+ */
+ @ConsumerType
+ public interface Password extends Field, StringConstraint {
+
+ }
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
index 786f295810..69492a1c9b 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
@@ -36,8 +36,7 @@
fieldLabel="Default value"
name="./default"
sling:hideResource="{Boolean}true"
- wrapperClass="cmp-adaptiveform-password__value"/>
-
+ wrapperClass="cmp-adaptiveform-password__value"/>
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
index 29293adc97..5e3f0f91b1 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/css/passwordview.css
@@ -41,4 +41,4 @@
.cmp-adaptiveform-password__questionmark {
}
-
\ No newline at end of file
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
index 12d384898e..2d87664496 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
@@ -16,3 +16,4 @@
#base=js
passwordview.js
+togglepasswordvisibility.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
new file mode 100644
index 0000000000..4117df083d
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright 2024 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+$(document).ready(function() {
+ $(document).on('click', '.ssnField .fisheye', function() {
+ var type = $(".ssnField").find("input").attr("type");
+ if (type == "text") {
+ $(".ssnField").find("input").attr("type", "password");
+ }
+
+ if (type == "password") {
+ $(".ssnField").find("input").attr("type", "text");
+ }
+ });
+ });
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
index 21f798bd59..ca576d8d58 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
@@ -55,4 +55,4 @@
-
\ No newline at end of file
+
From c9f007747b0a7584f4e5f211e813a3c84bb6f80b Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Tue, 27 Feb 2024 13:07:19 +0530
Subject: [PATCH 11/32] AF Password Field| Updated Javascript code, updated
apps pom.xml.
Updated Javascript code for toggle password visibility. Html code cleanups
---
.../site/js/togglepasswordvisibility.js | 27 ++++++++++---------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
index 4117df083d..7b8e434f79 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -13,16 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
-
-$(document).ready(function() {
- $(document).on('click', '.ssnField .fisheye', function() {
- var type = $(".ssnField").find("input").attr("type");
- if (type == "text") {
- $(".ssnField").find("input").attr("type", "password");
- }
-
- if (type == "password") {
- $(".ssnField").find("input").attr("type", "text");
- }
- });
- });
+(function() {
+ "use strict";
+ let togglePasswordButton = document.querySelector('.cmp-adaptiveform-password .fisheye');
+ let passwordInput = document.querySelector('input.cmp-adaptiveform-password__widget');
+ if(togglePasswordButton && passwordInput){
+ togglePasswordButton.addEventListener('click', function () {
+ if (passwordInput.type === 'password') {
+ passwordInput.type = 'text';
+ } else {
+ passwordInput.type = 'password';
+ }
+ });
+ }
+ })();
From 9ecb0d69b10735792e0498cb5026fcd7821e0aba Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 4 Mar 2024 12:58:59 +0530
Subject: [PATCH 12/32] AF Password|Test Cases and html updates supporting
responsiveness
---
.../models/v1/form/PasswordImplTest.java | 53 +---
.../exporter-password-customized.json | 2 -
.../resources/form/password/test-content.json | 283 +++++++++---------
.../site/js/togglepasswordvisibility.js | 4 +-
4 files changed, 152 insertions(+), 190 deletions(-)
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
index cf75eed440..452acf2d14 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -16,6 +16,8 @@
package com.adobe.cq.forms.core.components.internal.models.v1.form;
+import static org.junit.Assert.assertEquals;
+
import org.apache.commons.lang3.reflect.FieldUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -26,21 +28,21 @@
import com.adobe.cq.forms.core.components.models.form.FieldType;
import com.adobe.cq.forms.core.components.models.form.Password;
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
+
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
@ExtendWith(AemContextExtension.class)
public class PasswordImplTest {
- private static final String BASE = "/form/password";
+ private static final String BASE = "/form/password";
private static final String CONTENT_ROOT = "/content";
private static final String PATH_PASSWORD_DATALAYER = CONTENT_ROOT + "/password-datalayer";
private static final String PATH_PASSWORD_CUSTOMIZED = CONTENT_ROOT + "/password-customized";
- private static final String PATH_NUMBER_PASSWORD_EXCLUSIVE = CONTENT_ROOT + "/number-password-exclusive";
- private static final String PATH_NUMBER_PASSWORD_INPUT = CONTENT_ROOT + "/number-password";
+
+ private static final String PATH_PASSWORD = CONTENT_ROOT + "/password";
+
+ private static final String PATH_PASSWORD_PATTERN = CONTENT_ROOT + "/password-pattern";
private final AemContext context = FormsCoreComponentTestContext.newAemContext();
@@ -95,13 +97,6 @@ void testGetRequired() {
assertEquals(true, password.isRequired());
}
- @Test
- void testGetValidationPattern() {
- Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
- assertEquals("/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/", password.getValidationPattern());
-
- }
-
@Test
void testIsEnabled() {
Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
@@ -138,38 +133,18 @@ void testMaxLength() {
assertEquals(10, password.getMaxLength().intValue());
}
- @Test
- void testGetExclusiveMinimum() {
- Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_EXCLUSIVE, Password.class, context);
- assertNull(password.getMinimum());
- assertEquals(8L, password.getExclusiveMinimum().longValue());
- }
-
- @Test
- void testGetExclusiveMaximum() {
- Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_EXCLUSIVE, Password.class, context);
- assertNull(password.getMaximum());
- assertEquals(16L, password.getExclusiveMaximum().longValue());
- }
-
- @Test
- void testGetMinimum() {
- Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_INPUT, Password.class, context);
- assertEquals(8, password.getMinimum().intValue());
- }
-
- @Test
- void testGetMaximum() {
- Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_INPUT, Password.class, context);
- assertEquals(16, password.getMaximum().intValue());
- }
-
@Test
void testGetDisplayFormat() throws Exception {
Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
assertEquals("password", password.getFormat());
}
+ @Test
+ void testGetPattern() throws Exception {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_PATTERN, Password.class, context);
+ assertEquals("^(?=.*\\d.*\\d)[A-Za-z\\d!@]+$", password.getPattern());
+ }
+
@Test
void testDataLayerProperties() throws IllegalAccessException {
Password password = Utils.getComponentUnderTest(PATH_PASSWORD_DATALAYER, Password.class, context);
diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
index 02bd02f46b..6e813660f5 100644
--- a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
+++ b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
@@ -17,8 +17,6 @@
"readOnly": false,
"minLength": 5,
"maxLength": 10,
- "maximum" : 16,
- "minimum" : 1,
"exclusiveMinimum" : 8,
"exclusiveMaximum" : 16,
"validationPattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/",
diff --git a/bundles/af-core/src/test/resources/form/password/test-content.json b/bundles/af-core/src/test/resources/form/password/test-content.json
index 10748c1807..894c0469f5 100644
--- a/bundles/af-core/src/test/resources/form/password/test-content.json
+++ b/bundles/af-core/src/test/resources/form/password/test-content.json
@@ -1,157 +1,146 @@
{
- "password" : {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "core/fd/components/form/password/v1/password",
- "name" : "abc",
- "jcr:title" : "def",
- "fieldType": "password"
+ "password" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "fieldType": "password"
+ },
+ "password-customized" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "password",
+ "jcr:title" : "pwd",
+ "hideTitle" : false,
+ "dorExclusion": true,
+ "dorColspan": "4",
+ "dorBindRef": "Text1",
+ "description" : "password field",
+ "visible" : false,
+ "readOnly": false,
+ "enabled": true,
+ "required": true,
+ "minLength": 5,
+ "maxLength": 10,
+ "displayFormat" : "password",
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "placeholder": "Enter valid password",
+ "pattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/",
+ "default" : "password",
+ "fieldType": "password",
+ "label": {
+ "value": "Password",
+ "visible": true
+ }
+ },
+ "password-pattern" : {
+ "id": "password-91417957c6",
+ "fieldType": "password",
+ "name": "password1732174214265",
+ "visible": true,
+ "type": "string",
+ "enabled": true,
+ "constraintMessages": {
+ "pattern": "Enter valid password"
},
- "password-customized" : {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "core/fd/components/form/password/v1/password",
- "name" : "password",
- "jcr:title" : "pwd",
- "hideTitle" : false,
- "dorExclusion": true,
- "dorColspan": "4",
- "dorBindRef": "Text1",
- "description" : "password field",
- "visible" : false,
- "readOnly": false,
- "enabled": true,
- "required": true,
- "minLength": 5,
- "maxLength": 10,
- "displayFormat" : "password",
- "assistPriority" : "custom",
- "dataRef" : "a.b",
- "custom" : "Custom screen reader text",
- "typeMessage" : "incorrect type",
- "tooltip": "test-short-description",
- "placeholder": "Enter valid password",
- "validationPattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/",
- "default" : "password",
- "fieldType": "password",
- "label": {
- "value": "Password",
- "visible": true
- }
+ "readOnly": false,
+ "pattern": "^(?=.*\\d.*\\d)[A-Za-z\\d!@]+$",
+ "label": {
+ "visible": true,
+ "value": "Password"
},
- "number-password" : {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "core/fd/components/form/textinput/v1/textinput",
- "name" : "abc",
- "type" : "password",
- "jcr:title" : "def",
- "hideTitle" : false,
- "description" : "dummy",
- "visible" : false,
- "assistPriority" : "custom",
- "dataRef" : "a.b",
- "custom" : "Custom screen reader text",
- "typeMessage" : "incorrect type",
- "tooltip": "test-short-description",
- "fieldType": "text-input",
- "maximum" : 16,
- "minimum" : 8,
- "default" : 150
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
},
- "number-password-exclusive" : {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "core/fd/components/form/password/v1/password",
- "name" : "abc",
- "type" : "password",
- "jcr:title" : "def",
- "hideTitle" : false,
- "description" : "dummy",
- "visible" : false,
- "assistPriority" : "custom",
- "dataRef" : "a.b",
- "custom" : "Custom screen reader text",
- "typeMessage" : "incorrect type",
- "tooltip": "test-short-description",
- "fieldType": "text-input",
- "maximum" : 16,
- "minimum" : 8,
- "exclusiveMinimum" : true,
- "exclusiveMaximum" : true,
- "default" : 150
+ "properties": {
+ "fd:dor": {
+ "dorExclusion": false
+ },
+ "fd:path": "/content/forms/af/testcheckboaf2/jcr:content/guideContainer/password"
},
- "password-format" : {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "core/fd/components/form/password/v1/password",
- "name" : "abc",
- "jcr:title" : "def",
- "hideTitle" : false,
- "description" : "dummy",
- "visible" : false,
- "assistPriority" : "custom",
- "dataRef" : "a.b",
- "custom" : "Custom screen reader text",
- "typeMessage" : "incorrect type",
- "tooltip": "test-short-description",
- "default" : "abc",
- "fieldType": "password",
- "readOnly": false,
- "enabled": true,
- "displayFormat" : "password"
+ ":type": "forms-components-examples/components/form/password"
+ },
+
+ "password-format" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "hideTitle" : false,
+ "description" : "dummy",
+ "visible" : false,
+ "assistPriority" : "custom",
+ "dataRef" : "a.b",
+ "custom" : "Custom screen reader text",
+ "typeMessage" : "incorrect type",
+ "tooltip": "test-short-description",
+ "default" : "abc",
+ "fieldType": "password",
+ "readOnly": false,
+ "enabled": true,
+ "displayFormat" : "password"
+ },
+ "password-datalayer" : {
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "id": "password-1c7bc238a6",
+ "fieldType": "password",
+ "name": "Full Name",
+ "jcr:title" : "Full Name",
+ "visible": true,
+ "description": "Enter Full Name",
+ "tooltip": "Full Name",
+ "type": "string",
+ "required": true,
+ "enabled": true,
+ "readOnly": false,
+ "label": {
+ "value": "Full Name"
},
- "password-datalayer" : {
- "sling:resourceType" : "core/fd/components/form/password/v1/password",
- "id": "password-1c7bc238a6",
- "fieldType": "password",
- "name": "Full Name",
- "jcr:title" : "Full Name",
- "visible": true,
- "description": "Enter Full Name",
- "tooltip": "Full Name",
- "type": "string",
- "required": true,
- "enabled": true,
- "readOnly": false,
- "label": {
- "value": "Full Name"
- },
- "events": {
- "custom:setProperty": [
- "$event.payload"
- ]
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "properties": {
+ "afs:layout": {
+ "tooltipVisible": false
},
- "properties": {
- "afs:layout": {
- "tooltipVisible": false
- },
- "fd:dor": {
- "dorExclusion": false
- },
- "fd:path": "/content/forms/af/af2/jcr:content/guideContainer/password"
+ "fd:dor": {
+ "dorExclusion": false
},
- ":type": "forms-components-examples/components/form/password"
- },
- "password_unboundFormElement" : {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "core/fd/components/form/password/v1/password",
- "name" : "abc",
- "jcr:title" : "def",
- "fieldType": "password",
- "unboundFormElement": true,
- "dataRef": "$.h"
+ "fd:path": "/content/forms/af/af2/jcr:content/guideContainer/password"
},
- "password-blank-dataref" : {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "core/fd/components/form/password/v1/password",
- "name" : "abc",
- "jcr:title" : "def",
- "fieldType": "password",
- "dataRef": ""
- },
- "password-blank-validationExpression" : {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "core/fd/components/form/password/v1/password",
- "name" : "abc",
- "jcr:title" : "def",
- "fieldType": "password",
- "validationExpression": ""
- }
+ ":type": "forms-components-examples/components/form/password"
+ },
+ "password_unboundFormElement" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "fieldType": "password",
+ "unboundFormElement": true,
+ "dataRef": "$.h"
+ },
+ "password-blank-dataref" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "fieldType": "password",
+ "dataRef": ""
+ },
+ "password-blank-validationExpression" : {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "core/fd/components/form/password/v1/password",
+ "name" : "abc",
+ "jcr:title" : "def",
+ "fieldType": "password",
+ "validationExpression": ""
}
-
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
index 7b8e434f79..cdbb748860 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -15,8 +15,8 @@
******************************************************************************/
(function() {
"use strict";
- let togglePasswordButton = document.querySelector('.cmp-adaptiveform-password .fisheye');
- let passwordInput = document.querySelector('input.cmp-adaptiveform-password__widget');
+ const togglePasswordButton = document.querySelector('.cmp-adaptiveform-password__input-wrapper .eyeicon');
+ const passwordInput = document.querySelector('.cmp-adaptiveform-password__input-wrapper input.cmp-adaptiveform-password__widget');
if(togglePasswordButton && passwordInput){
togglePasswordButton.addEventListener('click', function () {
if (passwordInput.type === 'password') {
From e05f21fad692d6bee3e0d309f4e264909495c45e Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 11 Mar 2024 19:29:30 +0530
Subject: [PATCH 13/32] AF Password | PR review comments Updates
---
.../v1/password/clientlibs/site/js.txt | 1 -
.../site/js/togglepasswordvisibility.js | 29 -------------------
2 files changed, 30 deletions(-)
delete mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
index 2d87664496..12d384898e 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js.txt
@@ -16,4 +16,3 @@
#base=js
passwordview.js
-togglepasswordvisibility.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
deleted file mode 100644
index cdbb748860..0000000000
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright 2024 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-(function() {
- "use strict";
- const togglePasswordButton = document.querySelector('.cmp-adaptiveform-password__input-wrapper .eyeicon');
- const passwordInput = document.querySelector('.cmp-adaptiveform-password__input-wrapper input.cmp-adaptiveform-password__widget');
- if(togglePasswordButton && passwordInput){
- togglePasswordButton.addEventListener('click', function () {
- if (passwordInput.type === 'password') {
- passwordInput.type = 'text';
- } else {
- passwordInput.type = 'password';
- }
- });
- }
- })();
From a52e9b27b18481dfe28a922fdefd28b856ae0888 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Wed, 5 Jun 2024 12:42:24 +0530
Subject: [PATCH 14/32] AF-password||Resolved test cases and password java for
exclusive max and min values update
---
.../internal/models/v1/form/PasswordImpl.java | 23 +++++++++++++++++++
.../models/v1/form/PasswordImplTest.java | 2 ++
2 files changed, 25 insertions(+)
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
index 47a52102dd..f442e7390a 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -87,4 +87,27 @@ private void initPassword() {
}
}
+ @Override
+ public Long getExclusiveMaximum() {
+ return (Long) exclusiveMaximumValue;
+ }
+
+ @Override
+ public Long getExclusiveMinimum() {
+ return (Long) exclusiveMinimumVaue;
+ }
+
+ @PostConstruct
+ private void initTextInput() {
+ exclusiveMaximumValue = ComponentUtils.getExclusiveValue(exclusiveMaximum, maximum, null);
+ exclusiveMinimumVaue = ComponentUtils.getExclusiveValue(exclusiveMinimum, minimum, null);
+ // in json either, exclusiveMaximum or maximum should be present
+ if (exclusiveMaximumValue != null) {
+ maximum = null;
+ }
+ if (exclusiveMinimumVaue != null) {
+ minimum = null;
+ }
+ }
+
}
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
index 452acf2d14..97cddfd55b 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -39,6 +39,8 @@ public class PasswordImplTest {
private static final String CONTENT_ROOT = "/content";
private static final String PATH_PASSWORD_DATALAYER = CONTENT_ROOT + "/password-datalayer";
private static final String PATH_PASSWORD_CUSTOMIZED = CONTENT_ROOT + "/password-customized";
+ private static final String PATH_NUMBER_PASSWORD_EXCLUSIVE = CONTENT_ROOT + "/number-password-exclusive";
+ private static final String PATH_NUMBER_PASSWORD_INPUT = CONTENT_ROOT + "/number-password";
private static final String PATH_PASSWORD = CONTENT_ROOT + "/password";
From fa456798564c5f14060474986fd2fe43df30f700 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Thu, 1 Aug 2024 15:05:41 +0530
Subject: [PATCH 15/32] Validation pattern fix
---
.../resources/form/password/exporter-password-customized.json | 2 +-
.../library/adaptive-form/password/.content.xml | 2 +-
.../form/password/v1/password/_cq_dialog/.content.xml | 2 +-
.../core/fd/components/form/password/v1/password/password.html | 3 +--
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
index 6e813660f5..ff9c746dfc 100644
--- a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
+++ b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json
@@ -19,7 +19,7 @@
"maxLength": 10,
"exclusiveMinimum" : 8,
"exclusiveMaximum" : 16,
- "validationPattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/",
+ "pattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/",
"label": {
"value": "Password",
"visible": true
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
index 0237cad9c1..018e9b5933 100644
--- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
+++ b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
@@ -115,7 +115,7 @@
placeholder="Enter valid password"
tooltip="<p>This is a short description.</p>"
tooltipVisible="true"
- validationPattern="^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,20}$"/>
+ pattern="^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,20}$"/>
+ name="./pattern"/>
From 1f9b1eab72d68f782901976482350f588d174a4a Mon Sep 17 00:00:00 2001
From: Rishi Mehta <69448117+rismehta@users.noreply.github.com>
Date: Thu, 11 Jul 2024 09:25:52 +0530
Subject: [PATCH 16/32] Fixing flaky test (#1312)
* Fixing flaky test
* updating quickstart docker
* Fixing flaky test
---
.../internal/models/v1/form/PasswordImpl.java | 23 ---------------
.../site/js/togglepasswordvisibility.js | 28 +++++++++++++++++++
2 files changed, 28 insertions(+), 23 deletions(-)
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
index f442e7390a..47a52102dd 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -87,27 +87,4 @@ private void initPassword() {
}
}
- @Override
- public Long getExclusiveMaximum() {
- return (Long) exclusiveMaximumValue;
- }
-
- @Override
- public Long getExclusiveMinimum() {
- return (Long) exclusiveMinimumVaue;
- }
-
- @PostConstruct
- private void initTextInput() {
- exclusiveMaximumValue = ComponentUtils.getExclusiveValue(exclusiveMaximum, maximum, null);
- exclusiveMinimumVaue = ComponentUtils.getExclusiveValue(exclusiveMinimum, minimum, null);
- // in json either, exclusiveMaximum or maximum should be present
- if (exclusiveMaximumValue != null) {
- maximum = null;
- }
- if (exclusiveMinimumVaue != null) {
- minimum = null;
- }
- }
-
}
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
new file mode 100644
index 0000000000..4117df083d
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright 2024 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+$(document).ready(function() {
+ $(document).on('click', '.ssnField .fisheye', function() {
+ var type = $(".ssnField").find("input").attr("type");
+ if (type == "text") {
+ $(".ssnField").find("input").attr("type", "password");
+ }
+
+ if (type == "password") {
+ $(".ssnField").find("input").attr("type", "text");
+ }
+ });
+ });
From 5a4756ce32751dac6d32fdfd2a3de340d83c4f57 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Tue, 27 Feb 2024 13:07:19 +0530
Subject: [PATCH 17/32] AF Password Field| Updated Javascript code, updated
apps pom.xml.
Updated Javascript code for toggle password visibility. Html code cleanups
---
.../site/js/togglepasswordvisibility.js | 27 ++++++++++---------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
index 4117df083d..7b8e434f79 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -13,16 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
-
-$(document).ready(function() {
- $(document).on('click', '.ssnField .fisheye', function() {
- var type = $(".ssnField").find("input").attr("type");
- if (type == "text") {
- $(".ssnField").find("input").attr("type", "password");
- }
-
- if (type == "password") {
- $(".ssnField").find("input").attr("type", "text");
- }
- });
- });
+(function() {
+ "use strict";
+ let togglePasswordButton = document.querySelector('.cmp-adaptiveform-password .fisheye');
+ let passwordInput = document.querySelector('input.cmp-adaptiveform-password__widget');
+ if(togglePasswordButton && passwordInput){
+ togglePasswordButton.addEventListener('click', function () {
+ if (passwordInput.type === 'password') {
+ passwordInput.type = 'text';
+ } else {
+ passwordInput.type = 'password';
+ }
+ });
+ }
+ })();
From 858ea430527120e7eea4837f2fa1e1b7b7b022d0 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 4 Mar 2024 12:58:59 +0530
Subject: [PATCH 18/32] AF Password|Test Cases and html updates supporting
responsiveness
---
.../src/test/resources/form/password/test-content.json | 2 +-
.../password/clientlibs/site/js/togglepasswordvisibility.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bundles/af-core/src/test/resources/form/password/test-content.json b/bundles/af-core/src/test/resources/form/password/test-content.json
index 894c0469f5..8b85cd1773 100644
--- a/bundles/af-core/src/test/resources/form/password/test-content.json
+++ b/bundles/af-core/src/test/resources/form/password/test-content.json
@@ -143,4 +143,4 @@
"fieldType": "password",
"validationExpression": ""
}
-}
\ No newline at end of file
+}
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
index 7b8e434f79..cdbb748860 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -15,8 +15,8 @@
******************************************************************************/
(function() {
"use strict";
- let togglePasswordButton = document.querySelector('.cmp-adaptiveform-password .fisheye');
- let passwordInput = document.querySelector('input.cmp-adaptiveform-password__widget');
+ const togglePasswordButton = document.querySelector('.cmp-adaptiveform-password__input-wrapper .eyeicon');
+ const passwordInput = document.querySelector('.cmp-adaptiveform-password__input-wrapper input.cmp-adaptiveform-password__widget');
if(togglePasswordButton && passwordInput){
togglePasswordButton.addEventListener('click', function () {
if (passwordInput.type === 'password') {
From 0f802c6eb47df83fe2d5e669461e76dc797562de Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 11 Mar 2024 19:29:30 +0530
Subject: [PATCH 19/32] AF Password | PR review comments Updates
---
.../site/js/togglepasswordvisibility.js | 29 -------------------
1 file changed, 29 deletions(-)
delete mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
deleted file mode 100644
index cdbb748860..0000000000
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright 2024 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-(function() {
- "use strict";
- const togglePasswordButton = document.querySelector('.cmp-adaptiveform-password__input-wrapper .eyeicon');
- const passwordInput = document.querySelector('.cmp-adaptiveform-password__input-wrapper input.cmp-adaptiveform-password__widget');
- if(togglePasswordButton && passwordInput){
- togglePasswordButton.addEventListener('click', function () {
- if (passwordInput.type === 'password') {
- passwordInput.type = 'text';
- } else {
- passwordInput.type = 'password';
- }
- });
- }
- })();
From 740bde1233748dfc76707e6a8037f2640a8addd7 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Wed, 5 Jun 2024 12:42:24 +0530
Subject: [PATCH 20/32] AF-password||Resolved test cases and password java for
exclusive max and min values update
---
.../internal/models/v1/form/PasswordImpl.java | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
index 47a52102dd..f442e7390a 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -87,4 +87,27 @@ private void initPassword() {
}
}
+ @Override
+ public Long getExclusiveMaximum() {
+ return (Long) exclusiveMaximumValue;
+ }
+
+ @Override
+ public Long getExclusiveMinimum() {
+ return (Long) exclusiveMinimumVaue;
+ }
+
+ @PostConstruct
+ private void initTextInput() {
+ exclusiveMaximumValue = ComponentUtils.getExclusiveValue(exclusiveMaximum, maximum, null);
+ exclusiveMinimumVaue = ComponentUtils.getExclusiveValue(exclusiveMinimum, minimum, null);
+ // in json either, exclusiveMaximum or maximum should be present
+ if (exclusiveMaximumValue != null) {
+ maximum = null;
+ }
+ if (exclusiveMinimumVaue != null) {
+ minimum = null;
+ }
+ }
+
}
From 9f036bc0b60d632477634b3c405525d58f744c19 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Tue, 17 Sep 2024 12:04:17 +0530
Subject: [PATCH 21/32] Password Component feature addition for eye open and
close icons and fix ui tests
---
.../password/v1/password/clientlibs/site/js/passwordview.js | 2 ++
.../core/fd/components/form/password/v1/password/password.html | 2 +-
ui.tests/test-module/specs/password/password.authoring.spec.js | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
index 966dd5f42b..2a5bcfcd0d 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
@@ -93,8 +93,10 @@
const widget = this.getWidget();
if (widget.type === "password") {
widget.type = "text";
+ this.getEyeIcon().classList.remove('close');
} else {
widget.type = "password";
+ this.getEyeIcon().classList.add('close');
}
}
}
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
index 5f098d3a76..eb903dc27f 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
@@ -48,7 +48,7 @@
placeholder="${password.placeHolder}"
dir="auto"
aria-label="password" />
-
+
diff --git a/ui.tests/test-module/specs/password/password.authoring.spec.js b/ui.tests/test-module/specs/password/password.authoring.spec.js
index e35344b029..cb7589fed5 100644
--- a/ui.tests/test-module/specs/password/password.authoring.spec.js
+++ b/ui.tests/test-module/specs/password/password.authoring.spec.js
@@ -53,7 +53,7 @@ describe('Page - Authoring', function () {
cy.get(".cmp-adaptiveform-password__minlength").invoke('css', 'display').should('equal', 'block');
cy.get(".cmp-adaptiveform-base__placeholder").parent('div').invoke('css', 'display').should('equal', 'block');
cy.get('.cmp-adaptiveform-password__editdialog').contains('Validation').click({force: true}).then(() => {
- cy.get("[name='./validationPattern']").should('have.length', 1);
+ cy.get("[name='./pattern']").should('have.length', 1);
cy.get("[name='./validatePictureClauseMessage']").should('have.length', 1);
cy.get('.cq-dialog-cancel').click();
cy.deleteComponentByPath(passwordDrop);
From e6d0182d24e7b295f0fa9b9c3abb5c7e74abeff6 Mon Sep 17 00:00:00 2001
From: Rishi Mehta <69448117+rismehta@users.noreply.github.com>
Date: Mon, 30 Sep 2024 15:07:14 +0530
Subject: [PATCH 22/32] GH actions (#1428)
* GH actions
* Dummy change
* dummy
* change
* Fix error
* Fix error
* fix error
* Fix error
* fix regex
* Fix code
* dummy change
* Dummy change
* Fix errors
---
.github/workflows/exporter-validate-pr.yml | 2 +-
.../components/models/form/FieldType.java | 1 +
.../site/js/togglepasswordvisibility.js | 28 +++++++++++++++++++
3 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
diff --git a/.github/workflows/exporter-validate-pr.yml b/.github/workflows/exporter-validate-pr.yml
index 0907dd8f64..eb11202f23 100644
--- a/.github/workflows/exporter-validate-pr.yml
+++ b/.github/workflows/exporter-validate-pr.yml
@@ -64,4 +64,4 @@ jobs:
done
echo "All exporter JSON files have only additions. No backward incompatibility changes detected."
- shell: bash
+ shell: bash
\ No newline at end of file
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java
index 58fb6fb702..9eff634a66 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java
@@ -36,6 +36,7 @@ public enum FieldType {
FORM("form"),
CHECKBOX_GROUP("checkbox-group"),
IMAGE("image"),
+
TELEPHONE("tel"),
PASSWORD("password"),
RANGE("range"),
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
new file mode 100644
index 0000000000..4117df083d
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright 2024 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+$(document).ready(function() {
+ $(document).on('click', '.ssnField .fisheye', function() {
+ var type = $(".ssnField").find("input").attr("type");
+ if (type == "text") {
+ $(".ssnField").find("input").attr("type", "password");
+ }
+
+ if (type == "password") {
+ $(".ssnField").find("input").attr("type", "text");
+ }
+ });
+ });
From a647fc3bb3517052dd1259c9d9758edb6be3aa3e Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Fri, 23 Feb 2024 15:44:17 +0530
Subject: [PATCH 23/32] AF Password Component| Updated license year and few
code comments block update
---
.../internal/models/v1/form/PasswordImpl.java | 24 -------------------
1 file changed, 24 deletions(-)
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
index f442e7390a..c3b2f5efa2 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -86,28 +86,4 @@ private void initPassword() {
minimum = null;
}
}
-
- @Override
- public Long getExclusiveMaximum() {
- return (Long) exclusiveMaximumValue;
- }
-
- @Override
- public Long getExclusiveMinimum() {
- return (Long) exclusiveMinimumVaue;
- }
-
- @PostConstruct
- private void initTextInput() {
- exclusiveMaximumValue = ComponentUtils.getExclusiveValue(exclusiveMaximum, maximum, null);
- exclusiveMinimumVaue = ComponentUtils.getExclusiveValue(exclusiveMinimum, minimum, null);
- // in json either, exclusiveMaximum or maximum should be present
- if (exclusiveMaximumValue != null) {
- maximum = null;
- }
- if (exclusiveMinimumVaue != null) {
- minimum = null;
- }
- }
-
}
From 75b6d800de4e23fd10da38ab4efab434a68a714d Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Tue, 27 Feb 2024 13:07:19 +0530
Subject: [PATCH 24/32] AF Password Field| Updated Javascript code, updated
apps pom.xml.
Updated Javascript code for toggle password visibility. Html code cleanups
---
.../site/js/togglepasswordvisibility.js | 27 ++++++++++---------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
index 4117df083d..7b8e434f79 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -13,16 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
-
-$(document).ready(function() {
- $(document).on('click', '.ssnField .fisheye', function() {
- var type = $(".ssnField").find("input").attr("type");
- if (type == "text") {
- $(".ssnField").find("input").attr("type", "password");
- }
-
- if (type == "password") {
- $(".ssnField").find("input").attr("type", "text");
- }
- });
- });
+(function() {
+ "use strict";
+ let togglePasswordButton = document.querySelector('.cmp-adaptiveform-password .fisheye');
+ let passwordInput = document.querySelector('input.cmp-adaptiveform-password__widget');
+ if(togglePasswordButton && passwordInput){
+ togglePasswordButton.addEventListener('click', function () {
+ if (passwordInput.type === 'password') {
+ passwordInput.type = 'text';
+ } else {
+ passwordInput.type = 'password';
+ }
+ });
+ }
+ })();
From f93ac9ef35448de39cf81e84ffbce1fb21c77218 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 4 Mar 2024 12:58:59 +0530
Subject: [PATCH 25/32] AF Password|Test Cases and html updates supporting
responsiveness
---
.../password/clientlibs/site/js/togglepasswordvisibility.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
index 7b8e434f79..cdbb748860 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
@@ -15,8 +15,8 @@
******************************************************************************/
(function() {
"use strict";
- let togglePasswordButton = document.querySelector('.cmp-adaptiveform-password .fisheye');
- let passwordInput = document.querySelector('input.cmp-adaptiveform-password__widget');
+ const togglePasswordButton = document.querySelector('.cmp-adaptiveform-password__input-wrapper .eyeicon');
+ const passwordInput = document.querySelector('.cmp-adaptiveform-password__input-wrapper input.cmp-adaptiveform-password__widget');
if(togglePasswordButton && passwordInput){
togglePasswordButton.addEventListener('click', function () {
if (passwordInput.type === 'password') {
From 0f250b1558387cac0605a256f769e5efe7cba544 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 11 Mar 2024 19:29:30 +0530
Subject: [PATCH 26/32] AF Password | PR review comments Updates
---
.../site/js/togglepasswordvisibility.js | 29 -------------------
ui.frontend/src/constants.js | 12 ++++++++
2 files changed, 12 insertions(+), 29 deletions(-)
delete mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
deleted file mode 100644
index cdbb748860..0000000000
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/togglepasswordvisibility.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright 2024 Adobe
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-(function() {
- "use strict";
- const togglePasswordButton = document.querySelector('.cmp-adaptiveform-password__input-wrapper .eyeicon');
- const passwordInput = document.querySelector('.cmp-adaptiveform-password__input-wrapper input.cmp-adaptiveform-password__widget');
- if(togglePasswordButton && passwordInput){
- togglePasswordButton.addEventListener('click', function () {
- if (passwordInput.type === 'password') {
- passwordInput.type = 'text';
- } else {
- passwordInput.type = 'password';
- }
- });
- }
- })();
diff --git a/ui.frontend/src/constants.js b/ui.frontend/src/constants.js
index 04d6f8078e..7b6ad2a910 100644
--- a/ui.frontend/src/constants.js
+++ b/ui.frontend/src/constants.js
@@ -375,5 +375,17 @@ export const Constants = {
* @namespace FIELD_TYPE
*/
FIELD_TYPE: FIELD_TYPE
+
+ /**
+ * Html input type text
+ * @type {string}
+ */
+ HTML_INPUT_TYPE_TEXT : "text",
+
+ /**
+ * Html input type password
+ * @type {string}
+ */
+ HTML_INPUT_TYPE_PASSWORD : "password"
};
From d1da0a924ae8a1a46ea679c824dcd8751844b8c2 Mon Sep 17 00:00:00 2001
From: dgurjar
Date: Fri, 22 Nov 2024 12:18:23 +0530
Subject: [PATCH 27/32] Addressed review comments
---
.../internal/models/v1/form/PasswordImpl.java | 3 +-
.../components/models/form/FieldType.java | 1 -
.../models/v1/form/PasswordImplTest.java | 22 +++++-
.../password/exporter-password-datalayer.json | 2 +-
.../form/password/exporter-password.json | 26 +++++++
.../components/form/password/_cq_template.xml | 3 +-
.../adaptive-form/password/.content.xml | 70 -------------------
.../samples/password/basic/.content.xml | 17 +++++
.../clientlibs/editorhook/js/replacehook.js | 3 +-
.../form/password/v1/password/README.md | 24 ++++---
.../v1/password/_cq_dialog/.content.xml | 12 ----
.../password/v1/password/_cq_template.xml | 3 +-
.../v1/password/clientlibs/site/.content.xml | 2 +-
.../clientlibs/site/js/passwordview.js | 26 +++----
.../form/password/v1/password/password.html | 4 +-
ui.frontend/src/constants.js | 2 +-
...oring.spec.js => password.authoring.cy.js} | 4 +-
...runtime.spec.js => password.runtime.cy.js} | 7 ++
18 files changed, 112 insertions(+), 119 deletions(-)
create mode 100644 bundles/af-core/src/test/resources/form/password/exporter-password.json
rename ui.tests/test-module/specs/password/{password.authoring.spec.js => password.authoring.cy.js} (98%)
rename ui.tests/test-module/specs/password/{password.runtime.spec.js => password.runtime.cy.js} (94%)
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
index c3b2f5efa2..cca55ae28c 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java
@@ -29,6 +29,7 @@
import com.adobe.cq.export.json.ComponentExporter;
import com.adobe.cq.export.json.ExporterConstants;
import com.adobe.cq.forms.core.components.internal.form.FormConstants;
+import com.adobe.cq.forms.core.components.models.form.FieldType;
import com.adobe.cq.forms.core.components.models.form.Password;
import com.adobe.cq.forms.core.components.util.AbstractFieldImpl;
import com.adobe.cq.forms.core.components.util.ComponentUtils;
@@ -51,7 +52,7 @@ public class PasswordImpl extends AbstractFieldImpl implements Password {
@Override
public String getFieldType() {
- return super.getFieldType();
+ return getFieldType(FieldType.PASSWORD);
}
@Override
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java
index 9eff634a66..58fb6fb702 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java
@@ -36,7 +36,6 @@ public enum FieldType {
FORM("form"),
CHECKBOX_GROUP("checkbox-group"),
IMAGE("image"),
-
TELEPHONE("tel"),
PASSWORD("password"),
RANGE("range"),
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
index 97cddfd55b..296c3fcb5b 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -31,6 +31,7 @@
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
+import org.mockito.Mockito;
@ExtendWith(AemContextExtension.class)
public class PasswordImplTest {
@@ -39,8 +40,10 @@ public class PasswordImplTest {
private static final String CONTENT_ROOT = "/content";
private static final String PATH_PASSWORD_DATALAYER = CONTENT_ROOT + "/password-datalayer";
private static final String PATH_PASSWORD_CUSTOMIZED = CONTENT_ROOT + "/password-customized";
- private static final String PATH_NUMBER_PASSWORD_EXCLUSIVE = CONTENT_ROOT + "/number-password-exclusive";
- private static final String PATH_NUMBER_PASSWORD_INPUT = CONTENT_ROOT + "/number-password";
+
+ private static final String PATH_PASSWORD = CONTENT_ROOT + "/password";
+
+ private static final String PATH_PASSWORD_PATTERN = CONTENT_ROOT + "/password-pattern";
private static final String PATH_PASSWORD = CONTENT_ROOT + "/password";
@@ -53,6 +56,21 @@ void setUp() {
context.load().json(BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
}
+ @Test
+ void testExportedType() {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
+ assertEquals(FormConstants.RT_FD_FORM_PASSWORD_V1, password.getExportedType());
+ TextInput textInputMock = Mockito.mock(TextInput.class);
+ Mockito.when(textInputMock.getExportedType()).thenCallRealMethod();
+ assertEquals("", textInputMock.getExportedType());
+ }
+
+ @Test
+ void testJSONExport() throws Exception {
+ Password password = Utils.getComponentUnderTest(PATH_PASSWORD_PATTERN, Password.class, context);
+ Utils.testJSONExport(password, Utils.getTestExporterJSONPath(BASE, PATH_PASSWORD));
+ }
+
@Test
void testFieldType() {
Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json b/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json
index ab723a1dd2..6dafe57656 100644
--- a/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json
+++ b/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json
@@ -1,7 +1,7 @@
{
"id": "password-1c7bc238a6",
"fieldType": "password",
- "name": "Full Name",
+ "name": "password1732094911597",
"visible": true,
"description": "Enter Full Name",
"tooltip": "Full Name",
diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password.json b/bundles/af-core/src/test/resources/form/password/exporter-password.json
new file mode 100644
index 0000000000..148a0b951e
--- /dev/null
+++ b/bundles/af-core/src/test/resources/form/password/exporter-password.json
@@ -0,0 +1,26 @@
+{
+ "id": "password-91417957c6",
+ "fieldType": "password",
+ "name": "password1732174214265",
+ "visible": true,
+ "type": "string",
+ "enabled": true,
+ "readOnly": false,
+ "pattern": "^(?=.*\\d.*\\d)[A-Za-z\\d!@]+$",
+ "label": {
+ "value": ""
+ },
+ "events": {
+ "custom:setProperty": [
+ "$event.payload"
+ ]
+ },
+ "properties": {
+ ":type": "forms-components-examples/components/form/password",
+ "fd:dor": {
+ "dorExclusion": false
+ },
+ "fd:path": "/content/password-pattern"
+ },
+ ":type": "nt:unstructured"
+}
\ No newline at end of file
diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml
index fd92ff415e..359c182ba3 100644
--- a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml
+++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml
@@ -1,5 +1,4 @@
\ No newline at end of file
+ jcr:title="Password"/>
\ No newline at end of file
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
index 018e9b5933..5ea77a57d6 100644
--- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
+++ b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
@@ -117,76 +117,6 @@
tooltipVisible="true"
pattern="^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,20}$"/>
-
-
-
-
-
-
-
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js
index 3e3ae98578..aa31facd66 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js
@@ -40,7 +40,8 @@
'plain-text': fieldTypes.NON_INPUT,
'title': fieldTypes.NON_INPUT,
'image': fieldTypes.NON_INPUT,
- 'panel': fieldTypes.CONTAINER
+ 'panel': fieldTypes.CONTAINER,
+ 'password' : fieldTypes.TEXT
}
const preservedProperties = ['id', 'description', 'enabled', 'jcr:created', 'jcr:title', 'name',
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
index 05243a770b..43a319cc1a 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
@@ -36,9 +36,18 @@ The following properties are written to JCR for this Form Password component and
2. `./hideTitle` - if set to `true`, the label of this field will be hidden
3. `./name` - defines the name of the field, which will be submitted with the form data
4. `./description` - defines a help message that can be rendered in the field as a hint for the user
-5. `./required` - if set to `true`, this field will be marked as required, not allowing the form to be submitted until the field has a value
-6. `./requiredMessage` - defines the message displayed as tooltip when submitting the form if the value is left empty
-7. `./readOnly` - if set to `true`, the filed will be read only
+5. `./dataRef` - defines bind reference with model
+6. `./placeholder` - defines place holder for the field
+7. `./unboundFormElement` - defines if the field is unbound
+8. `./required` - if set to `true`, this field will be marked as required, not allowing the form to be submitted until the field has a value
+9. `./requiredMessage` - defines the message displayed as tooltip when submitting the form if the value is left empty
+10. `./readOnly` - if set to `true`, the filed will be read only
+11. `./maxLength` - define maximum characters permitted
+12. `./minLength` - define minimum characters permitted
+13. `./maxLengthMessage` - define maximum characters of error message permitted
+14. `./pattern` - define regular expression permitted
+15. `./minLengthMessage` - define minimum characters of error message permitted
+16. `./validatePictureClauseMessage` - define error message if wrong pattern is entered.
## Client Libraries
The component provides a `core.forms.components.password.v1.runtime` client library category that contains the Javascript runtime for the component.
@@ -57,22 +66,21 @@ BLOCK cmp-adaptiveform-password
ELEMENT cmp-adaptiveform-password__shortdescription
ELEMENT cmp-adaptiveform-password__longdescription
ELEMENT cmp-adaptiveform-password__errormessage
+ ELEMENT cmp-adaptiveform-password__eyeicon
+ ELEMENT cmp-adaptiveform-password__input-wrapper
```
### Note
By placing the class names `cmp-adaptiveform-password__label` and `cmp-adaptiveform-password__questionmark` within the `cmp-adaptiveform-password__label-container` class, you create a logical grouping of the label and question mark elements. This approach simplifies the process of maintaining a consistent styling for both elements.
## Replace feature:
-We support replace feature that allows replacing Reset Button component to any of the below components:
+We support replace feature that allows replacing Password component to any of the below components:
-* Button
-* Date Picker
* Email Input
* Number Input
-* Reset Button
-* Submit Button
* Telephone Input
* Text Box
+* Email Input
## JavaScript Data Attribute Bindings
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
index a748db185b..409d2d1d93 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml
@@ -92,18 +92,6 @@
sling:resourceType="fd/af/authoring/components/granite/form/fieldset"
title="Validation Pattern">
-
-
-
+ jcr:title="Password"/>
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml
index 27631c55e6..50764aff9f 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml
@@ -3,4 +3,4 @@
jcr:primaryType="cq:ClientLibraryFolder"
allowProxy="{Boolean}true"
categories="[core.forms.components.password.v1.runtime]"
- dependencies="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime]"/>
+ dependencies="[core.forms.components.runtime.base]"/>
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
index 2a5bcfcd0d..54d4b4ba2e 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
@@ -87,19 +87,19 @@
});
}
- #togglePasswordType(){
- const widget = this.getWidget();
- if(widget.value){
- const widget = this.getWidget();
- if (widget.type === "password") {
- widget.type = "text";
- this.getEyeIcon().classList.remove('close');
- } else {
- widget.type = "password";
- this.getEyeIcon().classList.add('close');
- }
- }
- }
+ #togglePasswordType(){
+ const widget = this.getWidget();
+ if(widget.value){
+ const widget = this.getWidget();
+ if (widget.type === "password") {
+ widget.type = "text";
+ this.getEyeIcon().classList.add('open');
+ } else {
+ widget.type = "password";
+ this.getEyeIcon().classList.remove('open');
+ }
+ }
+ }
}
FormView.Utils.setupField(({element, formContainer}) => {
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
index eb903dc27f..35776817fb 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html
@@ -47,8 +47,8 @@
required="${password.required}"
placeholder="${password.placeHolder}"
dir="auto"
- aria-label="password" />
-
+ aria-label="${password.label.visible != false ? '' : password.label.value}" />
+
diff --git a/ui.frontend/src/constants.js b/ui.frontend/src/constants.js
index 7b6ad2a910..a74dc91e20 100644
--- a/ui.frontend/src/constants.js
+++ b/ui.frontend/src/constants.js
@@ -374,7 +374,7 @@ export const Constants = {
* @memberof module:FormView~Constants
* @namespace FIELD_TYPE
*/
- FIELD_TYPE: FIELD_TYPE
+ FIELD_TYPE: FIELD_TYPE,
/**
* Html input type text
diff --git a/ui.tests/test-module/specs/password/password.authoring.spec.js b/ui.tests/test-module/specs/password/password.authoring.cy.js
similarity index 98%
rename from ui.tests/test-module/specs/password/password.authoring.spec.js
rename to ui.tests/test-module/specs/password/password.authoring.cy.js
index cb7589fed5..a6e4552e99 100644
--- a/ui.tests/test-module/specs/password/password.authoring.spec.js
+++ b/ui.tests/test-module/specs/password/password.authoring.cy.js
@@ -82,7 +82,7 @@ describe('Page - Authoring', function () {
// Check If Dialog Options Are Visible
cy.get(".cmp-adaptiveform-base__editdialogbasic [name='./name']")
.should("exist")
- .should("have.value", "password_copy_1");
+ .should("have.value", "Password_copy_1");
cy.get("coral-dialog.is-open coral-dialog-footer button[variant='default']").click();
cy.deleteComponentByPath(passwordDrop);
cy.deleteComponentByPath(passwordDrop + "_copy");
@@ -117,7 +117,7 @@ describe('Page - Authoring', function () {
testPasswordBehaviour(passwordEditPathSelector, passwordDrop);
})
- it.skip('pasted component should have unique name', function () {
+ it('pasted component should have unique name', function () {
testCopyPasteComponent(passwordEditPathSelector, passwordEditPathSelectorCopy, passwordDrop);
})
})
diff --git a/ui.tests/test-module/specs/password/password.runtime.spec.js b/ui.tests/test-module/specs/password/password.runtime.cy.js
similarity index 94%
rename from ui.tests/test-module/specs/password/password.runtime.spec.js
rename to ui.tests/test-module/specs/password/password.runtime.cy.js
index 236da69a6a..7163223cf1 100644
--- a/ui.tests/test-module/specs/password/password.runtime.spec.js
+++ b/ui.tests/test-module/specs/password/password.runtime.cy.js
@@ -158,5 +158,12 @@ describe("Form Runtime with Password", () => {
})
})
+
+ it("should show required error message on entering wrong validation pattern of password", () =>{
+ const [passwordbox11, passwordbox11FieldView] = Object.entries(formContainer._fields)[10];
+ cy.get(`#${passwordbox11}`).find("input").clear().type(1).blur().then(x => {
+ cy.get(`#${passwordbox11}`).find(".cmp-adaptiveform-password__errormessage").should('have.text',"Please enter valid password")
+ })
+ })
})
From 85a3153b993a5898dc9707162336957f9f0e039a Mon Sep 17 00:00:00 2001
From: Rishi Mehta
Date: Thu, 28 Nov 2024 10:34:17 +0530
Subject: [PATCH 28/32] Fixing GH workflow
---
.github/workflows/exporter-validate-pr.yml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/exporter-validate-pr.yml b/.github/workflows/exporter-validate-pr.yml
index eb11202f23..87c035df5e 100644
--- a/.github/workflows/exporter-validate-pr.yml
+++ b/.github/workflows/exporter-validate-pr.yml
@@ -48,10 +48,10 @@ jobs:
exit 1
fi
- # Check for changed values
- for key in $base_keys; do
- base_value=$(echo "$base_file" | jq -r --arg key "$key" '.[$key]')
- head_value=$(echo "$head_file" | jq -r --arg key "$key" '.[$key]')
+ # Check for changed values
+ for key in $base_keys; do
+ base_value=$(echo "$base_file" | jq -r ".$key")
+ head_value=$(echo "$head_file" | jq -r ".$key")
if [ "$base_value" != "$head_value" ]; then
echo "Backward incompatibility change detected in $file. The value of key '$key' was changed from '$base_value' to '$head_value'."
From 2c4303cbc60c88fb9fa4136dfdb3b44df060c3dc Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Fri, 29 Nov 2024 16:29:36 +0530
Subject: [PATCH 29/32] AF Password|PR review comments
---
bundles/af-core/.fbExcludeFilterFile | 41 +++++++++++++++++++
.../models/v1/form/PasswordImplTest.java | 11 ++---
.../adaptive-form/password/.content.xml | 14 +++----
.../form/password/v1/password/README.md | 2 +-
.../clientlibs/site/js/passwordview.js | 24 +++++------
5 files changed, 67 insertions(+), 25 deletions(-)
create mode 100644 bundles/af-core/.fbExcludeFilterFile
diff --git a/bundles/af-core/.fbExcludeFilterFile b/bundles/af-core/.fbExcludeFilterFile
new file mode 100644
index 0000000000..dbf0a3447c
--- /dev/null
+++ b/bundles/af-core/.fbExcludeFilterFile
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
index 296c3fcb5b..5a4a356691 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -22,16 +22,17 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mockito;
import com.adobe.cq.forms.core.Utils;
import com.adobe.cq.forms.core.components.datalayer.FormComponentData;
+import com.adobe.cq.forms.core.components.internal.form.FormConstants;
import com.adobe.cq.forms.core.components.models.form.FieldType;
import com.adobe.cq.forms.core.components.models.form.Password;
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
-import org.mockito.Mockito;
@ExtendWith(AemContextExtension.class)
public class PasswordImplTest {
@@ -57,12 +58,12 @@ void setUp() {
}
@Test
- void testExportedType() {
+ void testExportedType() throws Exception {
Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
assertEquals(FormConstants.RT_FD_FORM_PASSWORD_V1, password.getExportedType());
- TextInput textInputMock = Mockito.mock(TextInput.class);
- Mockito.when(textInputMock.getExportedType()).thenCallRealMethod();
- assertEquals("", textInputMock.getExportedType());
+ Password passwordMock = Mockito.mock(Password.class);
+ Mockito.when(passwordMock.getExportedType()).thenCallRealMethod();
+ assertEquals("", passwordMock.getExportedType());
}
@Test
diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
index 5ea77a57d6..e97222c1be 100644
--- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
+++ b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml
@@ -5,7 +5,7 @@
cq:lastModified="{Date}2024-03-12T12:04:40.719+05:30"
cq:lastModifiedBy="admin"
cq:template="/conf/core-components-examples/settings/wcm/templates/content-page"
- jcr:description="Text Input"
+ jcr:description="Password"
jcr:primaryType="cq:PageContent"
jcr:title="Password"
sling:resourceType="forms-components-examples/components/page"
@@ -25,7 +25,7 @@
jcr:lastModified="{Date}2024-03-12T11:09:55.804+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
- sling:resourceType="core/wcm/components/text/v2/text"
+ sling:resourceType="core/wcm/components/password/v1/password"
text="<h1>Password<sub>v1</sub></h1>
"
textIsRich="true"/>
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
index 43a319cc1a..499db3745d 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md
@@ -80,7 +80,7 @@ We support replace feature that allows replacing Password component to any of th
* Number Input
* Telephone Input
* Text Box
-* Email Input
+* Date Picker
## JavaScript Data Attribute Bindings
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
index 54d4b4ba2e..d4230f9ca6 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js
@@ -87,19 +87,19 @@
});
}
- #togglePasswordType(){
- const widget = this.getWidget();
- if(widget.value){
- const widget = this.getWidget();
- if (widget.type === "password") {
- widget.type = "text";
- this.getEyeIcon().classList.add('open');
- } else {
- widget.type = "password";
- this.getEyeIcon().classList.remove('open');
- }
- }
+ #togglePasswordType() {
+ const widget = this.getWidget();
+ if (widget.value) {
+ const widget = this.getWidget();
+ if (widget.type === "password") {
+ widget.type = "text";
+ this.getEyeIcon().classList.add('open');
+ } else {
+ widget.type = "password";
+ this.getEyeIcon().classList.remove('open');
}
+ }
+ }
}
FormView.Utils.setupField(({element, formContainer}) => {
From ffc3f3b784583a61045e35b4f705b454c7ee6396 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Mon, 6 Jan 2025 12:03:31 +0530
Subject: [PATCH 30/32] AF-Password-Component |PR review comments fixes
---
bundles/af-core/.fbExcludeFilterFile | 41 ----------------------------
1 file changed, 41 deletions(-)
delete mode 100644 bundles/af-core/.fbExcludeFilterFile
diff --git a/bundles/af-core/.fbExcludeFilterFile b/bundles/af-core/.fbExcludeFilterFile
deleted file mode 100644
index dbf0a3447c..0000000000
--- a/bundles/af-core/.fbExcludeFilterFile
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From d4633ccd84cc7f5e9a5bf5acb681e9b924145c52 Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Tue, 14 Jan 2025 20:44:35 +0530
Subject: [PATCH 31/32] Fix commit issues
---
.../components/internal/models/v1/form/PasswordImplTest.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
index 5a4a356691..f88c4525b4 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -46,10 +46,6 @@ public class PasswordImplTest {
private static final String PATH_PASSWORD_PATTERN = CONTENT_ROOT + "/password-pattern";
- private static final String PATH_PASSWORD = CONTENT_ROOT + "/password";
-
- private static final String PATH_PASSWORD_PATTERN = CONTENT_ROOT + "/password-pattern";
-
private final AemContext context = FormsCoreComponentTestContext.newAemContext();
@BeforeEach
From f193d340eef7fd5343f6708fbc2f0632412d301b Mon Sep 17 00:00:00 2001
From: Sushil Kumar <88363275+kum-sushil@users.noreply.github.com>
Date: Tue, 14 Jan 2025 21:23:36 +0530
Subject: [PATCH 32/32] Fix merge conflict issues
---
.../internal/form/FormConstants.java | 2 +-
.../core/components/models/form/Password.java | 24 +++++++++----------
.../models/v1/form/PasswordImplTest.java | 7 +++---
3 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
index e835534436..72689244d3 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java
@@ -142,6 +142,6 @@ private FormConstants() {
/* The resource type for the pre-selected the linked panel */
public final static String RT_FD_FORM_REVIEW_DATASOURCE_V1 = RT_FD_FORM_PREFIX + "review/v1/datasource";
-
+
public static final String RT_FD_FORM_PASSWORD_V1 = RT_FD_FORM_PREFIX + "password/v1/password";
}
diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
index 89f55e38b1..f97bf94926 100644
--- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
+++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java
@@ -14,16 +14,16 @@
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
- package com.adobe.cq.forms.core.components.models.form;
+package com.adobe.cq.forms.core.components.models.form;
- import org.osgi.annotation.versioning.ConsumerType;
-
- /**
- * Interface for {@code Password} Sling Model used for the {@code /apps/core/fd/components/form/password/v1/password} component.
- *
- * @since com.adobe.cq.forms.core.components.models.form 5.11.0
- */
- @ConsumerType
- public interface Password extends Field, StringConstraint {
-
- }
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Interface for {@code Password} Sling Model used for the {@code /apps/core/fd/components/form/password/v1/password} component.
+ *
+ * @since com.adobe.cq.forms.core.components.models.form 5.11.0
+ */
+@ConsumerType
+public interface Password extends Field, StringConstraint {
+
+}
diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
index f88c4525b4..c4b669e726 100644
--- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
+++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java
@@ -16,8 +16,6 @@
package com.adobe.cq.forms.core.components.internal.models.v1.form;
-import static org.junit.Assert.assertEquals;
-
import org.apache.commons.lang3.reflect.FieldUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -30,14 +28,15 @@
import com.adobe.cq.forms.core.components.models.form.FieldType;
import com.adobe.cq.forms.core.components.models.form.Password;
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
-
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
+import static org.junit.Assert.assertEquals;
+
@ExtendWith(AemContextExtension.class)
public class PasswordImplTest {
- private static final String BASE = "/form/password";
+ private static final String BASE = "/form/password";
private static final String CONTENT_ROOT = "/content";
private static final String PATH_PASSWORD_DATALAYER = CONTENT_ROOT + "/password-datalayer";
private static final String PATH_PASSWORD_CUSTOMIZED = CONTENT_ROOT + "/password-customized";