diff --git a/docs/source/plugindev.rst b/docs/source/plugindev.rst index dd5a2b2..0452863 100644 --- a/docs/source/plugindev.rst +++ b/docs/source/plugindev.rst @@ -189,3 +189,32 @@ Example Usage: def get_last_updated_timestamp(self): return TimeStampPlugin.get_last_updated_timestamp('TestPlugin') + + +Password Validation +------------------- + +Allows the plugin to define rules to set the password. The validators +are functions which receive the password as only argument and if it +doesn't match the desired rules raises a `ValidationError`. The message +sent in the validation error will be displayed to user in the HTML form. + +Example: + +.. code-block:: python + + ## myplugin/password_validators.py + + def has_uppercase_char(password): + for char in password: + if char.isupper(): + return + + raise ValidationError('Password must have at least one upper case char') + + ## /etc/colab/plugins.d/myplugin.py + + password_validators = ( + 'myplugin.password_validators.has_uppercase_char', + ) + diff --git a/docs/source/user.rst b/docs/source/user.rst index 2d2e10f..f8b70e1 100644 --- a/docs/source/user.rst +++ b/docs/source/user.rst @@ -165,6 +165,15 @@ Declares the additional installed apps that this plugin depends on. This doesn't automatically install the python dependecies, only add to django apps. +.. attribute:: password_validators + +A lista of functions to validade password in the moment it's set. +This allows plugins to define their own password validators. For +example if the proxied app requires the password to have at least +one upper case character it should provide a password validator +for that. + + urls ++++ -- libgit2 0.21.2