Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Improve errors messages

Smaug#67396c09f10cbcd6
diff --git a/backend/controllers/users.controller.go b/backend/controllers/users.controller.go
index a0be3df3..c65e6fe2 100644
--- a/backend/controllers/users.controller.go
+++ b/backend/controllers/users.controller.go
@@ -81,7 +81,7 @@ func (ctr *Controller) CreateUser(c *gin.Context) (int, any) {
return http.StatusBadRequest, err
}
if len(user.Password) == 0 {
- return http.StatusBadRequest, errors.New("password must be provided")
+ return http.StatusBadRequest, errors.New("password is required")
}
hash, err := bcrypt.GenerateFromPassword([]byte(user.Password), bcrypt.DefaultCost)
if err != nil {
@@ -180,7 +180,7 @@ func (ctr *Controller) UpdatePassword(c *gin.Context) (int, any) {
return http.StatusBadRequest, errors.New("invalid request payload")
}
if payload.Password == "" {
- return http.StatusBadRequest, errors.New("password must be provided")
+ return http.StatusBadRequest, errors.New("password is required")
}
// Hash the new password
hash, err := bcrypt.GenerateFromPassword([]byte(payload.Password), bcrypt.DefaultCost)