bug fix - remove secret

This commit is contained in:
MHSanaei
2024-03-12 20:45:44 +03:30
parent 4d07b99fe7
commit dd21bb2db7
2 changed files with 33 additions and 5 deletions

View File

@@ -79,6 +79,21 @@ func (s *UserService) GetUserSecret(id int) *model.User {
return user
}
func (s *UserService) CheckSecretExistence() (bool, error) {
db := database.GetDB()
var count int64
err := db.Model(model.User{}).
Where("login_secret IS NOT NULL").
Count(&count).
Error
if err != nil {
return false, err
}
return count > 0, nil
}
func (s *UserService) UpdateFirstUser(username string, password string) error {
if username == "" {
return errors.New("username can not be empty")