- Length should be 8 to 16 characters.
- Must include uppercase, lowercase, numbers, and special characters.
- Configuration for a retention period and history repetition.
You can set the logic in server side:
import frappe
def validate_password_policy(doc, method):
password = doc.new_password or doc.password
if password:
if len(password) < 8 or len(password) > 16:
frappe.throw("Password length must be between 8 and 16 characters.")
if not any(char.isupper() for char in password):
frappe.throw("Password must include at least one uppercase letter.")
if not any(char.islower() for char in password):
frappe.throw("Password must include at least one lowercase letter.")
if not any(char.isdigit() for char in password):
frappe.throw("Password must include at least one number.")
special_characters = '!@#$%^&*(),.?":{}|<>'
if not any(char in special_characters for char in password):
frappe.throw("Password must include at least one special character.")
which doctype add this and this working in user registration in UI page password validation
@Manish_Kumar Please Write in your registration doctype where your registration form details are store
1 Like
core user doctype
Users should set a password after signing up and use the following validation.
By default also provided the feature so check it in the System Settings.
- Enable Password Policy: Enables a password strength checker so that users have to use strong passwords for their login.
- Minimum Password Score: Score for the password strength checker
- 2 is medium
- 3 is strong
- 4 is very strongThe complexity is based on the number of characters, capitalization, special characters, etc.