bump copyright, added stats page and updated dependencies

This commit is contained in:
ston1th 2020-01-11 11:32:27 +01:00
commit 0265d820fe
111 changed files with 9556 additions and 3835 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2019 Marius Schellenberger
// Copyright (C) 2020 Marius Schellenberger
package server
@ -712,7 +712,7 @@ func userNewHandler(ctx *Context) {
return
}
log.Printf("create: user %s created by %s\n", user, ctx.User())
ctx.Redirect("/users", http.StatusFound)
ctx.Redirect(core.UsersURI, http.StatusFound)
}
}
@ -754,7 +754,7 @@ func userEditHandler(ctx *Context) {
return
}
log.Printf("update: user %s updated by %s\n", user, ctx.User())
ctx.Redirect("/users", http.StatusFound)
ctx.Redirect(core.UsersURI, http.StatusFound)
return
}
if err := ctx.Srv.DB.UpdateUserPassword(user, password); err != nil {
@ -832,7 +832,7 @@ func userTotpHandler(ctx *Context) {
} else {
log.Printf("totp: enabled by %s for %s\n", user, req.Username)
}
ctx.Redirect("/user/edit/"+req.Username, http.StatusFound)
ctx.Redirect(core.UserURI+"/edit/"+req.Username, http.StatusFound)
}
}
@ -842,7 +842,7 @@ func userUnlockHandler(ctx *Context) {
log.Println("unlock:", err)
}
log.Printf("unlock: %s unlocked by %s\n", user, ctx.User())
ctx.Redirect("/users", http.StatusFound)
ctx.Redirect(core.UsersURI, http.StatusFound)
}
func userDelHandler(ctx *Context) {
@ -871,10 +871,23 @@ func userDelHandler(ctx *Context) {
}
log.Printf("delete: user %s deleted by %s\n", user, self)
if user == self {
ctx.Redirect("/logout", http.StatusFound)
ctx.Redirect(core.LogoutURI, http.StatusFound)
return
}
ctx.Redirect("/users", http.StatusFound)
ctx.Redirect(core.UsersURI, http.StatusFound)
}
}
func statsHandler(ctx *Context) {
ctx.Template("statsHandler")
ctx.Data = webData{
Title: "Stats",
BodyTitle: "Stats",
}
switch ctx.Method() {
case "GET":
ctx.Data.Data = getStats(ctx.Srv.DB.Index)
ctx.Exec()
}
}