Skip to content

Commit

Permalink
Signup email
Browse files Browse the repository at this point in the history
  • Loading branch information
nilandev committed Nov 12, 2023
1 parent aa66d79 commit 881f0e8
Show file tree
Hide file tree
Showing 5 changed files with 477 additions and 469 deletions.
5 changes: 3 additions & 2 deletions bloggy/forms/signup_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ def save(self, commit=True):
user = super().save(commit=False) # Call the parent class's save method
# Generate the username based on the user's name (you can use your custom function here)
user.username = self.generate_unique_username(self.cleaned_data['name'])
user.is_active = True
user.is_active = False
user.is_staff = False

if commit:
user.save()
return user

def generate_unique_username(self, name):
@staticmethod
def generate_unique_username(name):
# Convert the user's name to a lowercase username with underscores
base_username = name.lower().replace(' ', '_')

Expand Down
Loading

0 comments on commit 881f0e8

Please sign in to comment.