From: Alviro Iskandar Setiawan <[email protected]>
To: Fernanda Ma'rouf <[email protected]>,
Akiekano <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>,
Alviro Iskandar Setiawan <[email protected]>,
GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH buubuu v1 3/5] auth-controller: Register: Render register.html on HTTP GET request
Date: Fri, 27 May 2022 20:39:18 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOG64qNDyrKyV_TqTdP6pdVAyTn1=hRppnOoJ=e9T73C9Nsjmg@mail.gmail.com>
Make Register() function in the auth-controller render the previously
created view, register.html. Only render this file when the user visits
this endpoint with HTTP method "GET".
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
controller/auth-controller.go | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/controller/auth-controller.go b/controller/auth-controller.go
index 958f452..afc8da4 100644
--- a/controller/auth-controller.go
+++ b/controller/auth-controller.go
@@ -51,7 +51,12 @@ func (c *authController) Login(ctx *gin.Context) {
}
func (c *authController) Register(ctx *gin.Context) {
- ctx.HTML(http.StatusOK, "index.html",gin.H{})
+
+ if (ctx.Request.Method == "GET") {
+ ctx.HTML(http.StatusOK, "register.html", gin.H{})
+ return
+ }
+
var registerDTO dto.RegisterDTO
errDTO := ctx.ShouldBind(®isterDTO)
if errDTO != nil {
--
Alviro Iskandar Setiawan
next prev parent reply other threads:[~2022-05-27 20:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 20:34 [PATCH buubuu v1 0/5] Login and Register page Alviro Iskandar Setiawan
2022-05-27 20:39 ` [PATCH buubuu v1 1/5] view: Create register.html Alviro Iskandar Setiawan
2022-05-27 20:39 ` [PATCH buubuu v1 2/5] view: Create login.html Alviro Iskandar Setiawan
2022-05-27 20:39 ` Alviro Iskandar Setiawan [this message]
2022-05-27 20:39 ` [PATCH buubuu v1 4/5] auth-controller: Login: Render login.html on HTTP GET request Alviro Iskandar Setiawan
2022-05-27 20:39 ` [PATCH buubuu v1 5/5] server: auth: Create `/login` route Alviro Iskandar Setiawan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220527203920.2474126-3-alviro.iskandar@gnuweeb.org \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox