From 74a3686b665320ef88fc1286a56ac4f8732179e3 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Sat, 27 Jan 2024 22:50:08 -0500 Subject: added basic http auth --- main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 4bb4889..0b3a60c 100644 --- a/main.go +++ b/main.go @@ -54,15 +54,13 @@ func (hw handlerWrapper) postHandler(context echo.Context) error { if !ok { return context.JSON(http.StatusUnauthorized, "unauthorized") } - log.Println(user, pass) userRecord, err := hw.app.Dao().FindAuthRecordByUsername("users", user) if err != nil { return context.JSON(http.StatusUnauthorized, "unauthorized") } - log.Println(userRecord.Get("password")) - if userRecord.Get("password") != pass { + if !userRecord.ValidatePassword(pass) { return context.JSON(http.StatusUnauthorized, "unauthorized") } -- cgit v1.2.3