From 3b52f65821ba09de37503e7cae9fd209ffb61e9c Mon Sep 17 00:00:00 2001 From: Leon Date: Wed, 21 Feb 2024 23:06:17 +0800 Subject: [PATCH] refactor: user API routes and update form actions --- cmd/srv/controller/user_api.go | 4 ++-- model/user.go | 2 +- resource/template/login.html | 2 +- resource/template/register.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/srv/controller/user_api.go b/cmd/srv/controller/user_api.go index 60d2749..504094c 100644 --- a/cmd/srv/controller/user_api.go +++ b/cmd/srv/controller/user_api.go @@ -19,8 +19,8 @@ type userAPI struct { func (ua *userAPI) serve() { ur := ua.r.Group("") - ur.POST("/login", ua.login) - ur.POST("/register", ua.register) + ur.POST("/user/login", ua.login) + ur.POST("/user/register", ua.register) v1 := ua.r.Group("v1") { diff --git a/model/user.go b/model/user.go index 0554086..a76b4c5 100644 --- a/model/user.go +++ b/model/user.go @@ -13,7 +13,7 @@ import ( type User struct { Common UserName string `json:"username,omitempty" gorm:"unique;column:username"` - Password string `json:"password,omitempty" gorm:"column:password"` + Password string `json:"-" gorm:"column:password"` ForgotPasswordCode string `json:"forgot_password_code,omitempty" gorm:"column:forgot_password_code"` VerificationCode string `json:"verification_code,omitempty" gorm:"column:verification_code"` diff --git a/resource/template/login.html b/resource/template/login.html index b347dbf..66cc430 100644 --- a/resource/template/login.html +++ b/resource/template/login.html @@ -1,6 +1,6 @@ {{ define "login" }} {{template "base/header" .}} -
+

Go-Gin Login

diff --git a/resource/template/register.html b/resource/template/register.html index 3b05490..f40de1c 100644 --- a/resource/template/register.html +++ b/resource/template/register.html @@ -1,6 +1,6 @@ {{ define "register" }} {{template "base/header" .}} - +

Go-Gin Register