Validate a password
Цей контент ще не доступний вашою мовою.
validatePassword checks a password against a password policy, the Password Policy of a customer or an account in the panel. Call it from your sign-up or self-care forms before you create the account or change its password, and show the fault message to the user when the password is refused.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
i_password_policy |
int | yes | ID of the password policy to check against |
password |
string | yes | Password to check |
web_label |
string | yes | Name of the password field as your form shows it, for example Web Password. It is used in the error message, so pass it already translated into lang |
lang |
string | no | Language of the error message, for example en or uk |
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK when the password meets the policy |
A password that does not meet the policy returns a fault. Its faultString is a readable message in lang that names the field by web_label; show it to the user as it is.
Example
Section titled “Example”import xmlrpc.client
try: call("validatePassword", { "i_password_policy": 2, "password": "summer", "web_label": "Web Password", "lang": "en", })except xmlrpc.client.Fault as fault: print(fault.faultString) # show it next to the password field{"result": "OK"}Related
Section titled “Related”- Customers and Accounts: the Password Policy field
- Create an account
- Create a customer
- Manage password policies