Fórum

How to remove the "Enter again" filed from Create account portlet ?

thumbnail
Shilpa B, modificado 7 Anos atrás.

How to remove the "Enter again" filed from Create account portlet ?

Junior Member Postagens: 61 Data de Entrada: 02/08/12 Postagens Recentes
I have created a Hook to customize the Create account portlet, i'm using Liferay 6.2
to display password section i'm using "users.password1.name.always.autogenerate=true​" in portal.properties file.

I can see the two Password fields one is Password and another is Enter Again.

My requirement is I want to show only one Password filed i.e. Password, how achieve this one.

Please let me know solution for this requirement.
thumbnail
Samuel Kong, modificado 7 Anos atrás.

RE: How to remove the "Enter again" filed from Create account portlet ?

Liferay Legend Postagens: 1902 Data de Entrada: 10/03/08 Postagens Recentes
The easiest solution that I can think of is to turn the second password field into a hidden input field using a JSP Hook. After that, just add a bit of JavaScript to copy whatever value the first password field into the second hidden password field.
thumbnail
Shilpa B, modificado 7 Anos atrás.

RE: How to remove the "Enter again" filed from Create account portlet ?

Junior Member Postagens: 61 Data de Entrada: 02/08/12 Postagens Recentes
Hi Samuel Kong,

I have already tried with this solution but still its throwing error as "The passwords you entered do not match. Please re-enter your password."
Somehow it is not working.

Is there any other way to have it done?
thumbnail
Samuel Kong, modificado 7 Anos atrás.

RE: How to remove the "Enter again" filed from Create account portlet ?

Liferay Legend Postagens: 1902 Data de Entrada: 10/03/08 Postagens Recentes
Are you sure the form is submitting the same password for both password fields? Try double checking your JavaScript.
thumbnail
Gaurav Jain, modificado 7 Anos atrás.

RE: How to remove the "Enter again" filed from Create account portlet ?

Junior Member Postagens: 85 Data de Entrada: 12/07/16 Postagens Recentes
Hi Shilpa,

You can try this if you have not found the solution yet.

You just need to modify html/portal/update_password.jsp in following manner:

Replace the <aui:fieldset label="new-password"> section of original file with following code :

<aui:fieldset label="new-password">
<aui:input id="lfr-input-text-container" autoFocus="<%= true %>"
class="lfr-input-text-container" label="password" name="password1"
type="password"
onchange="document.getElementById('lfr-input-text-container2').value = this.value; "
/>
<input id="lfr-input-text-container2" class="lfr-input-text-container2" name="password2" type="hidden" />
</aui:fieldset>

Thats all.

This will fulfill your requirement.
thumbnail
Shilpa B, modificado 7 Anos atrás.

RE: How to remove the "Enter again" filed from Create account portlet ?

Junior Member Postagens: 61 Data de Entrada: 02/08/12 Postagens Recentes
I'm trying in the create_account.jsp file with the below code, but still its not working
Please suggest me anything is wrong.

<script>
function assignVal(){
document.getElementById("againPwd").value=document.getElementById("pwd").value;
}
</script>

<form>
<c:if
test="<%=PropsValues.LOGIN_CREATE_ACCOUNT_ALLOW_CUSTOM_PASSWORD%>">
<aui:input label="password1" name="password1" size="30"
type="password" value="" id="pwd" onblur="assignVal()"/>

<aui:input label="enter-again" name="password2" size="30"
type="hidden" value="" id="againPwd" >
<aui:validator name="equalTo">
'#<portlet:namespace />password1'
</aui:validator>
</aui:input>
</c:if>
</form>


@Gaurav Jain: Why we have to customize the html/portal/update_password.jsp is there any specific reason, I yet to try with solution I will try and let you know.
thumbnail
Gaurav Jain, modificado 7 Anos atrás.

RE: How to remove the "Enter again" filed from Create account portlet ?

Junior Member Postagens: 85 Data de Entrada: 12/07/16 Postagens Recentes
Hi Shilpa ,

Shilpa B:
I'm trying in the create_account.jsp file with the below code, but still its not working
Please suggest me anything is wrong.

@Gaurav Jain: Why we have to customize the html/portal/update_password.jsp is there any specific reason, I yet to try with solution I will try and let you know.


No there is no any specific reason to this. You may do this in create_account.jsp too.

If you want to achieve your functionality through create_account.jsp then you must set following property to true in portal-ext.properties:

#login.create.account.allow.custom.password=true

Because this is by default false. And if you have noticed there is a check just before password fields in create_account.jsp
So these fields will be there if and only if this property is true.

One more thing in java script when you try to get any aui element you need to use <portlet:namespace /> as follows:

document.getElementById("<portlet:namespace />password2").value=document.getElementById("<portlet:namespace />password1").value;