aboutsummaryrefslogtreecommitdiff
path: root/internal/route/user/auth.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-10-22 14:56:25 +0800
committerGitHub <noreply@github.com>2022-10-22 14:56:25 +0800
commit7cbd84d5b3d4af36e4afcf7af9374bc765f6bb9c (patch)
tree74f4fd7f5df3af0680ddbb16c3c5f1b4985e5eb2 /internal/route/user/auth.go
parentc502dc6ed888a4cf2c8b36176585f4166536ab6d (diff)
refactor(db): rename `User.Passwd` to `User.Password` (#7196)
Diffstat (limited to 'internal/route/user/auth.go')
-rw-r--r--internal/route/user/auth.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/route/user/auth.go b/internal/route/user/auth.go
index 38751cb6..213ff050 100644
--- a/internal/route/user/auth.go
+++ b/internal/route/user/auth.go
@@ -60,7 +60,7 @@ func AutoLogin(c *context.Context) (bool, error) {
return false, nil
}
- if val, ok := c.GetSuperSecureCookie(u.Rands+u.Passwd, conf.Security.CookieRememberName); !ok || val != u.Name {
+ if val, ok := c.GetSuperSecureCookie(u.Rands+u.Password, conf.Security.CookieRememberName); !ok || val != u.Name {
return false, nil
}
@@ -122,7 +122,7 @@ func afterLogin(c *context.Context, u *db.User, remember bool) {
if remember {
days := 86400 * conf.Security.LoginRememberDays
c.SetCookie(conf.Security.CookieUsername, u.Name, days, conf.Server.Subpath, "", conf.Security.CookieSecure, true)
- c.SetSuperSecureCookie(u.Rands+u.Passwd, conf.Security.CookieRememberName, u.Name, days, conf.Server.Subpath, "", conf.Security.CookieSecure, true)
+ c.SetSuperSecureCookie(u.Rands+u.Password, conf.Security.CookieRememberName, u.Name, days, conf.Server.Subpath, "", conf.Security.CookieSecure, true)
}
_ = c.Session.Set("uid", u.ID)
@@ -334,7 +334,7 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
u := &db.User{
Name: f.UserName,
Email: f.Email,
- Passwd: f.Password,
+ Password: f.Password,
IsActive: !conf.Auth.RequireEmailConfirmation,
}
if err := db.CreateUser(u); err != nil {
@@ -544,7 +544,7 @@ func ResetPasswdPost(c *context.Context) {
return
}
- u.Passwd = passwd
+ u.Password = passwd
var err error
if u.Rands, err = db.GetUserSalt(); err != nil {
c.Error(err, "get user salt")