1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-11-16 15:27:54 +00:00

Make the lock work

There is a new config field: Authorization.Locked.

I am a little bit sorry for how actually the lock is implemented. I've added the check on almost every handler there is. Good luck maintaining that ❤️
This commit is contained in:
Timur Ismagilov
2021-07-11 00:04:21 +05:00
parent d8f4f40f52
commit 5d45ae67d4
9 changed files with 123 additions and 26 deletions

View File

@@ -54,6 +54,9 @@ func handlerStyle(w http.ResponseWriter, rq *http.Request) {
}
func handlerUserList(w http.ResponseWriter, rq *http.Request) {
if shown := user.FromRequest(rq).ShowLockMaybe(w, rq); shown {
return
}
w.Header().Set("Content-Type", mime.TypeByExtension(".html"))
w.WriteHeader(http.StatusOK)
w.Write([]byte(views.BaseHTML("User list", views.UserListHTML(), user.FromRequest(rq))))