musician crypt password when create mailboxuser

This commit is contained in:
Jorge Pastor 2024-04-18 16:58:37 +02:00
parent 5c0c82d50b
commit 60771b7808
1 changed files with 6 additions and 0 deletions

View File

@ -137,6 +137,12 @@ class MailboxCreateForm(forms.ModelForm):
)
return password
def clean(self):
cleaned_data = super().clean()
password = cleaned_data.get("password")
cleaned_data['password'] = make_password(password)
return cleaned_data
def save(self, commit=True):
instance = super().save(commit=False)
instance.account = self.user