From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [138.197.159.143]) by gnuweeb.org (Postfix) with ESMTPSA id 8C25B7ED88; Fri, 27 May 2022 20:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1653683967; bh=sdB2CAyM8A9y18cikukPBOp9WpdwkHakdSA79wjmc0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=reR0Om4Rhi18OCuhZVDZ6gdu/vT7JO74N7Wva44AnXeJl/PEF440X+9G38pbct+Ai 3aIIZdIk7ctUGPjiT98tsxPPLHTLnWd0/wJ3RPTZwEp89LjwRJLhUGWwWksRM7AYLm lpICwB3r4Em/cN0QzK1jx7PpaM8BiyW49m15jvDmA4MPf+Jq8TrMaLxtfDWWMquNea PUH6vBxuoa66h/DfAfwGF5/zWqO3+wflhZOyi754hT//0I9PurXR89hb3yr8l7YK+l 8VWMJ3nKWithauD0jD+gRFx4uYdAdog1Hc/dF9oVvZvO9wcOijqntyL+4WyaHHShF4 nZx92u3XEJ33g== From: Alviro Iskandar Setiawan To: Fernanda Ma'rouf , Akiekano Cc: Alviro Iskandar Setiawan , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH buubuu v1 4/5] auth-controller: Login: Render login.html on HTTP GET request Date: Fri, 27 May 2022 20:39:19 +0000 Message-Id: <20220527203920.2474126-4-alviro.iskandar@gnuweeb.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Make Login() function in the auth-controller render the previously created view, login.html. Only render this file when the user visits this endpoint with HTTP method "GET". Signed-off-by: Alviro Iskandar Setiawan --- controller/auth-controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controller/auth-controller.go b/controller/auth-controller.go index afc8da4..034f07e 100644 --- a/controller/auth-controller.go +++ b/controller/auth-controller.go @@ -31,6 +31,12 @@ func NewAuthController(authService service.AuthService, jwtService service.JWTSe } func (c *authController) Login(ctx *gin.Context) { + + if (ctx.Request.Method == "GET") { + ctx.HTML(http.StatusOK, "login.html", gin.H{}) + return + } + var loginDTO dto.LoginDTO errDTO := ctx.ShouldBind(&loginDTO) if errDTO != nil { -- Alviro Iskandar Setiawan