summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandomChars <random@chars.jp>2021-08-22 13:07:41 +0900
committerRandomChars <random@chars.jp>2021-08-22 13:07:41 +0900
commit0144d277e90e691051660d0ec440504da4fd4208 (patch)
treec0e4376541a792f207597d4c18c2cbc957a1da3c
parentde8b46f417b5e97496a27216d8aabf1b7fa97a50 (diff)
more consistent user add
-rw-r--r--api.go2
-rw-r--r--store/store.go2
-rw-r--r--store/user.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/api.go b/api.go
index cc5162c..1b5252d 100644
--- a/api.go
+++ b/api.go
@@ -55,7 +55,7 @@ func registerAPI() {
return
}
- context.JSON(http.StatusOK, instance.UserAdd(payload.Username, payload.Privileged, payload.Password))
+ context.JSON(http.StatusOK, instance.UserAdd(payload.Username, payload.Password, payload.Privileged))
})
router.GET(api.UserThis, func(context *gin.Context) {
diff --git a/store/store.go b/store/store.go
index 803a4f1..7fdfaaf 100644
--- a/store/store.go
+++ b/store/store.go
@@ -185,7 +185,7 @@ func (s *Store) create() error {
}
// Create initial user
- info := s.UserAdd("root", true, "initial")
+ info := s.UserAdd("root", "initial", true)
if info.Snowflake == "" {
log.Fatal("Error creating initial user.")
} else {
diff --git a/store/user.go b/store/user.go
index 7f9eabd..354739e 100644
--- a/store/user.go
+++ b/store/user.go
@@ -68,7 +68,7 @@ func (s *Store) UserMetadata(info User) {
}
// UserAdd creates a user.
-func (s *Store) UserAdd(username string, privileged bool, password string) User {
+func (s *Store) UserAdd(username, password string, privileged bool) User {
if len(username) > 64 || !nameRegex.MatchString(username) || s.file(s.UsernamePath(username)) {
return User{}
}