[remove] unused JSON API routes
This commit is contained in:
17
api/auth.go
17
api/auth.go
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user