fix(json): change groups default from empty string to empty string slice

This commit is contained in:
Slug-Boi
2025-04-02 19:27:03 +02:00
parent 0f45cd9cd9
commit 375d7f98e5
+10 -1
View File
@@ -250,6 +250,15 @@ func (m *model_ca) AddAuthor() {
} }
defer f.Close() defer f.Close()
var groups []string
if m.inputs[4].Value() == "" {
groups = []string{}
} else {
groups = strings.Split(m.inputs[4].Value(), "|")
}
// create and add the user to the users map // create and add the user to the users map
usr := utils.User{ usr := utils.User{
@@ -258,7 +267,7 @@ func (m *model_ca) AddAuthor() {
Username: m.inputs[2].Value(), Username: m.inputs[2].Value(),
Email: m.inputs[3].Value(), Email: m.inputs[3].Value(),
Ex: m.exclude, Ex: m.exclude,
Groups: strings.Split(m.inputs[4].Value(), "|"), Groups: groups,
} }
utils.Users[m.inputs[0].Value()] = usr utils.Users[m.inputs[0].Value()] = usr