Skip to content

Commit

Permalink
refactor: user API routes and update form actions
Browse files Browse the repository at this point in the history
  • Loading branch information
funnyzak committed Feb 21, 2024
1 parent d56fa32 commit 3b52f65
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/srv/controller/user_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand Down
2 changes: 1 addition & 1 deletion model/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down
2 changes: 1 addition & 1 deletion resource/template/login.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ define "login" }}
{{template "base/header" .}}
<form class="gogin-form" action="{{ .Conf.Site.BaseURL }}/api/login?page=1" method="post">
<form class="gogin-form" action="{{ .Conf.Site.BaseURL }}/api/user/login?page=1" method="post">
<h1>Go-Gin Login</h1>
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
Expand Down
2 changes: 1 addition & 1 deletion resource/template/register.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ define "register" }}
{{template "base/header" .}}
<form class="gogin-form" action="{{ .Conf.Site.BaseURL }}/api/register?page=1" method="post">
<form class="gogin-form" action="{{ .Conf.Site.BaseURL }}/api/user/register?page=1" method="post">
<h1>Go-Gin Register</h1>
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
Expand Down

0 comments on commit 3b52f65

Please sign in to comment.