summaryrefslogtreecommitdiffstats
path: root/internal/admin
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin')
-rw-r--r--internal/admin/server.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/admin/server.go b/internal/admin/server.go
index 858d498..bad7e66 100644
--- a/internal/admin/server.go
+++ b/internal/admin/server.go
@@ -73,10 +73,10 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Returns true if the request is authorised (or if auth is disabled).
func (s *Server) checkAuth(w http.ResponseWriter, r *http.Request) bool {
if s.AuthFile == "" {
- return true
+ return false
}
if _, err := os.Stat(s.AuthFile); os.IsNotExist(err) {
- return true // no passwords file → no auth required
+ return false
}
a := auth.New(s.AuthFile)
username, password, ok := r.BasicAuth()
@@ -107,10 +107,10 @@ func (s *Server) handleNew(w http.ResponseWriter, r *http.Request) {
return
}
s.render(w, "form", map[string]any{
- "Title": "New Post",
- "Action": "/admin/new",
- "Post": post{Date: time.Now().Format("2006-01-02")},
- "IsNew": true,
+ "Title": "New Post",
+ "Action": "/admin/new",
+ "Post": post{Date: time.Now().Format("2006-01-02")},
+ "IsNew": true,
})
}