留言板
Password Policies
hi
I'm editing password policies on my portal, but i want to have something that is not available by now. I want passwords to have at least:
- 1 uppercase (A-Z)
- 1 lowercase (a-z)
- 1 digit (0-9)
besides the length of the password, is there a way to enable that or i have to do it directly on the code? if the second, where can i start (which classes have the password policies?)
Thanks!
Regards
I'm editing password policies on my portal, but i want to have something that is not available by now. I want passwords to have at least:
- 1 uppercase (A-Z)
- 1 lowercase (a-z)
- 1 digit (0-9)
besides the length of the password, is there a way to enable that or i have to do it directly on the code? if the second, where can i start (which classes have the password policies?)
Thanks!
Regards
You really don't need to modify any code. Just add the following property in portal-ext.properties:
#
# If you choose to use com.liferay.portal.security.pwd.RegExpToolkit as
# your password toolkit, set the regular expression pattern that will be
# used to generate and validate passwords.
#
# Note that \ is replaced with \\ to work in Java.
#
# The first pattern ensures that passwords must have at least 4 valid
# characters consisting of digits or letters.
#
# The second pattern ensures that passwords must have at least 8 valid
# characters consisting of digits or letters.
#
passwords.regexptoolkit.pattern=(?=.{4})(?:[a-zA-Z0-9]*)
#
# Set the character sets for password validation.
#
passwords.passwordpolicytoolkit.charset.lowercase=abcdefghjkmnpqrstuvwxyz
passwords.passwordpolicytoolkit.charset.numbers=0123456789
passwords.passwordpolicytoolkit.charset.symbols=_.!@$*=-?
passwords.passwordpolicytoolkit.charset.uppercase=ABCDEFGHJKLMNPQRSTUVWXYZ
If you want to write your own policy, just specify your class here:
#
# Input a class name that extends
# com.liferay.portal.security.pwd.BasicToolkit. This class will be called to
# generate and validate passwords.
#
passwords.toolkit=com.liferay.portal.security.pwd.PasswordPolicyToolkit
#passwords.toolkit=com.liferay.portal.security.pwd.RegExpToolkit
#
# If you choose to use com.liferay.portal.security.pwd.RegExpToolkit as
# your password toolkit, set the regular expression pattern that will be
# used to generate and validate passwords.
#
# Note that \ is replaced with \\ to work in Java.
#
# The first pattern ensures that passwords must have at least 4 valid
# characters consisting of digits or letters.
#
# The second pattern ensures that passwords must have at least 8 valid
# characters consisting of digits or letters.
#
passwords.regexptoolkit.pattern=(?=.{4})(?:[a-zA-Z0-9]*)
#
# Set the character sets for password validation.
#
passwords.passwordpolicytoolkit.charset.lowercase=abcdefghjkmnpqrstuvwxyz
passwords.passwordpolicytoolkit.charset.numbers=0123456789
passwords.passwordpolicytoolkit.charset.symbols=_.!@$*=-?
passwords.passwordpolicytoolkit.charset.uppercase=ABCDEFGHJKLMNPQRSTUVWXYZ
If you want to write your own policy, just specify your class here:
#
# Input a class name that extends
# com.liferay.portal.security.pwd.BasicToolkit. This class will be called to
# generate and validate passwords.
#
passwords.toolkit=com.liferay.portal.security.pwd.PasswordPolicyToolkit
#passwords.toolkit=com.liferay.portal.security.pwd.RegExpToolkit
hi Hitoshi
i have a question... do this work on liferay 5.2.3 version???
i added the properties you gave me, but if i try to change the password ignoring them it lets me do it...
Regards
i have a question... do this work on liferay 5.2.3 version???
i added the properties you gave me, but if i try to change the password ignoring them it lets me do it...
Regards
Hi,
For Liferay 5.2.3, below are the properties that you need to set.
#
# If you choose to use com.liferay.portal.security.pwd.RegExpToolkit as
# your password toolkit, set the regular expression pattern that will be
# used to generate and validate passwords.
#
# Note that \ is replaced with \\ to work in Java.
#
# The first pattern ensures that passwords must have at least 4 valid
# characters consisting of digits or letters.
#
# The second pattern ensures that passwords must have at least 8 valid
# characters consisting of digits or letters.
#
passwords.regexptoolkit.pattern=(?=.{4})(?:[a-zA-Z0-9]*)
#passwords.regexptoolkit.pattern=(?=.{8})(?:[a-zA-Z0-9]*)
#
# Set the length and key for generating passwords.
#
#passwords.regexptoolkit.charset=0123456789
passwords.regexptoolkit.charset=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
#passwords.regexptoolkit.length=4
passwords.regexptoolkit.length=8
#
# Set the name of the default password policy.
#
passwords.default.policy.name=Default Password Policy
Hope it will work for you.
Thanks,
Hiral
For Liferay 5.2.3, below are the properties that you need to set.
#
# If you choose to use com.liferay.portal.security.pwd.RegExpToolkit as
# your password toolkit, set the regular expression pattern that will be
# used to generate and validate passwords.
#
# Note that \ is replaced with \\ to work in Java.
#
# The first pattern ensures that passwords must have at least 4 valid
# characters consisting of digits or letters.
#
# The second pattern ensures that passwords must have at least 8 valid
# characters consisting of digits or letters.
#
passwords.regexptoolkit.pattern=(?=.{4})(?:[a-zA-Z0-9]*)
#passwords.regexptoolkit.pattern=(?=.{8})(?:[a-zA-Z0-9]*)
#
# Set the length and key for generating passwords.
#
#passwords.regexptoolkit.charset=0123456789
passwords.regexptoolkit.charset=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
#passwords.regexptoolkit.length=4
passwords.regexptoolkit.length=8
#
# Set the name of the default password policy.
#
passwords.default.policy.name=Default Password Policy
Hope it will work for you.
Thanks,
Hiral