Add personal team on registration
This commit is contained in:
@@ -49,7 +49,18 @@ func (s *Service) Register(registration Registration) (*Session, error) {
|
|||||||
return nil, ErrRegistrationNotAllowed
|
return nil, ErrRegistrationNotAllowed
|
||||||
}
|
}
|
||||||
if authenticator, ok := s.authenticators[registration.Method]; ok {
|
if authenticator, ok := s.authenticators[registration.Method]; ok {
|
||||||
return authenticator.Register(context.Background(), registration)
|
session, err := authenticator.Register(context.Background(), registration)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = s.userRepository.CreateTeam(session.User.ID, &domain.Team{
|
||||||
|
Label: "Espace personnel",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return session, nil
|
||||||
} else {
|
} else {
|
||||||
return nil, ErrMethodUnknown
|
return nil, ErrMethodUnknown
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user