refactor: shorten model and table prefixes
This commit is contained in:
@@ -38,7 +38,7 @@ func (s *Service) CreateInvite(adminID uint, email string) (string, error) {
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Service) RegisterWithInvite(token, email, displayName, password string) (*models.SenlinAgentUser, error) {
|
||||
func (s *Service) RegisterWithInvite(token, email, displayName, password string) (*models.SaUser, error) {
|
||||
payload, err := s.verifyToken(token, "invite")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -50,7 +50,7 @@ func (s *Service) RegisterWithInvite(token, email, displayName, password string)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user := &models.SenlinAgentUser{
|
||||
user := &models.SaUser{
|
||||
Email: payload.Subject,
|
||||
DisplayName: strings.TrimSpace(displayName),
|
||||
PasswordHash: string(hash),
|
||||
@@ -60,7 +60,7 @@ func (s *Service) RegisterWithInvite(token, email, displayName, password string)
|
||||
}
|
||||
|
||||
func (s *Service) Login(email, password string) (string, error) {
|
||||
var user models.SenlinAgentUser
|
||||
var user models.SaUser
|
||||
if err := models.DBService.Where("email = ?", strings.ToLower(strings.TrimSpace(email))).First(&user).Error; err != nil {
|
||||
return "", errors.New("invalid credentials")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user