[remove] unused JSON API routes

This commit is contained in:
2023-09-26 19:14:33 -04:00
parent df7f806834
commit 4caec5fbe0
5 changed files with 36 additions and 206 deletions

View File

@@ -12,6 +12,7 @@ import (
"reichard.io/bbank/database"
)
// KOSync API Auth Headers
type authHeader struct {
AuthUser string `header:"x-auth-user"`
AuthKey string `header:"x-auth-key"`
@@ -90,6 +91,8 @@ func (api *API) authFormLogin(c *gin.Context) {
})
return
}
// MD5 - KOSync Compatiblity
password := fmt.Sprintf("%x", md5.Sum([]byte(rawPassword)))
if authorized := api.authorizeCredentials(username, password); authorized != true {
@@ -109,13 +112,6 @@ func (api *API) authFormLogin(c *gin.Context) {
c.Redirect(http.StatusFound, "/")
}
func (api *API) authLogout(c *gin.Context) {
session := sessions.Default(c)
session.Clear()
session.Save()
c.Redirect(http.StatusFound, "/login")
}
func (api *API) authFormRegister(c *gin.Context) {
if !api.Config.RegistrationEnabled {
c.AbortWithStatus(http.StatusConflict)
@@ -173,3 +169,10 @@ func (api *API) authFormRegister(c *gin.Context) {
c.Redirect(http.StatusFound, "/")
}
func (api *API) authLogout(c *gin.Context) {
session := sessions.Default(c)
session.Clear()
session.Save()
c.Redirect(http.StatusFound, "/login")
}