From 8f2180401fd05ba63633d9559dc156f5ca1573ba Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 9 Sep 2023 10:20:31 +0530 Subject: logging in with either username or email --- auth/controller.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'auth/controller.go') diff --git a/auth/controller.go b/auth/controller.go index 277a85a..1e6f7fe 100644 --- a/auth/controller.go +++ b/auth/controller.go @@ -25,6 +25,7 @@ import ( "vidhukant.com/openbills/user" "net/http" "time" + "fmt" ) var ( @@ -68,12 +69,15 @@ func handleSignUp (ctx *gin.Context) { } func handleSignIn (ctx *gin.Context) { - var u user.User - ctx.Bind(&u) + var req LoginReq + ctx.Bind(&req) + + fmt.Println(req) var err error + var u user.User - err = user.CheckPassword(u.ID, u.Password) + err = user.CheckPassword(&u, req.AccountName, req.Method, req.Password) if err != nil { // TODO: handle potential errors ctx.Error(err) -- cgit v1.2.3