[FIX] Initialize required User fields explicitly during registration
- Set Role to 'user' explicitly - Set IsActive to true explicitly - Set IsVerified to false explicitly - Prevents database constraint errors when creating new users - Ensures all required fields are set even if database defaults are missing
This commit is contained in:
parent
231c11b808
commit
1011ddd4a3
1 changed files with 3 additions and 1 deletions
|
|
@ -120,7 +120,9 @@ func (s *AuthService) Register(ctx context.Context, email, username, password st
|
|||
Username: username,
|
||||
Slug: strings.ToLower(username),
|
||||
PasswordHash: string(hashedPassword),
|
||||
// IsVerified: false par défaut
|
||||
Role: "user", // Valeur par défaut
|
||||
IsActive: true, // Valeur par défaut
|
||||
IsVerified: false, // Valeur par défaut
|
||||
}
|
||||
|
||||
if err := s.db.WithContext(ctx).Create(user).Error; err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue