add asterisk to required fields, allow editing of device keys

This commit is contained in:
Christoph Haas
2020-12-18 22:26:36 +01:00
parent ec60dd136a
commit d978fd560d
6 changed files with 46 additions and 24 deletions

View File

@@ -19,19 +19,21 @@ func (s *Server) GetAdminEditInterface(c *gin.Context) {
}
c.HTML(http.StatusOK, "admin_edit_interface.html", struct {
Route string
Alerts []FlashData
Session SessionData
Static StaticData
Peers []User
Device Device
Route string
Alerts []FlashData
Session SessionData
Static StaticData
Peers []User
Device Device
EditableKeys bool
}{
Route: c.Request.URL.Path,
Alerts: s.getFlashes(c),
Session: currentSession,
Static: s.getStaticData(),
Peers: users,
Device: currentSession.FormData.(Device),
Route: c.Request.URL.Path,
Alerts: s.getFlashes(c),
Session: currentSession,
Static: s.getStaticData(),
Peers: users,
Device: currentSession.FormData.(Device),
EditableKeys: s.config.Core.EditableKeys,
})
}

View File

@@ -202,7 +202,7 @@ type Device struct {
Interface *wgtypes.Device `gorm:"-"`
DeviceName string `form:"device" gorm:"primaryKey" binding:"required,alphanum"`
PrivateKey string `form:"privkey" binding:"base64"`
PrivateKey string `form:"privkey" binding:"required,base64"`
PublicKey string `form:"pubkey" binding:"required,base64"`
PersistentKeepalive int `form:"keepalive" binding:"gte=0"`
ListenPort int `form:"port" binding:"required,gt=0"`