Password¶
Overview¶
Use Password to control secret values like passwords or keys.
Make field¶
Collapsar will assume the field if you pass only pass 1 parameter. You can define the label and field name this way:
Hashing¶
Password fields automatically Hashes the value on create or update. You can customize this behaviour overriding the fill method.
# collapsar.fields.Password.py
from masonite.facades.Hash import Hash
def fill(self, request, model: "Model"):
"""Fill the field"""
setattr(model, self.attribute, Hash.make(request.input(self.attribute)))
return None
Info
For advanced validations see Validations.