various code cleanup,

add required tag to select template
This commit is contained in:
2025-05-12 20:59:48 +00:00
parent 800ad7cd60
commit 2b5c1bbf11
8 changed files with 189 additions and 223 deletions

View File

@@ -9,18 +9,6 @@ import (
"github.com/go-viper/mapstructure/v2"
)
// used when requesting GET /access/domains
type GetRealmsBody struct {
Data []Realm `json:"data"`
}
// stores each realm's data
type Realm struct {
Default int `json:"default"`
Realm string `json:"realm"`
Comment string `json:"comment"`
}
func GetLoginRealms() ([]Realm, error) {
realms := []Realm{}
@@ -49,6 +37,18 @@ func GetLoginRealms() ([]Realm, error) {
return realms, nil
}
// used when requesting GET /access/domains
type GetRealmsBody struct {
Data []Realm `json:"data"`
}
// stores each realm's data
type Realm struct {
Default int `json:"default"`
Realm string `json:"realm"`
Comment string `json:"comment"`
}
func HandleGETLogin(c *gin.Context) {
realms, err := GetLoginRealms()
if err != nil {
@@ -56,7 +56,8 @@ func HandleGETLogin(c *gin.Context) {
}
sel := common.Select{
ID: "realm",
ID: "realm",
Required: true,
}
for _, realm := range realms {