Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改token后无法登录,附简单修复 #57

Closed
winezer0 opened this issue Aug 23, 2022 · 2 comments
Closed

修改token后无法登录,附简单修复 #57

winezer0 opened this issue Aug 23, 2022 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@winezer0
Copy link

Environments
linux amd 64、windows amd 64

RevSuit Version
0.5.0

Describe the bug
A clear and concise description of what the bug is.
通过内置面板修改密码后,Token头和Cookie头不统一,导致无法登录
(token更新了、但cookie未更新、且路由中先获取的是cookie中的token)

To Reproduce
image

image

image

不优美的修复方案
修改\pkg\server\router.go文件的30行,分别获取token值
func (revsuit *Revsuit) registerPlatformRouter() {
// /api need Authorization
api := revsuit.http.Router.Group(revsuit.config.AdminPathPrefix + "/api")
api.Use(func(c *gin.Context) {
tokenCookie, _ := c.Cookie("token")
tokenToken := c.Request.Header.Get("Token")
if tokenToken != revsuit.http.Token && tokenCookie != revsuit.http.Token {
c.Abort()
c.Status(403)
}
})
revsuit.http.ApiGroup = api
.....

@winezer0 winezer0 changed the title 通过面板修改token后会无法登录 通过面板修改token后会无法登录,附简单修复 Aug 23, 2022
@winezer0 winezer0 changed the title 通过面板修改token后会无法登录,附简单修复 修改token后会无法登录,附简单修复 Aug 23, 2022
@winezer0 winezer0 changed the title 修改token后会无法登录,附简单修复 修改token后无法登录,附简单修复 Aug 23, 2022
@Li4n0 Li4n0 added the bug Something isn't working label Sep 13, 2022
@Li4n0
Copy link
Owner

Li4n0 commented Sep 13, 2022

感谢反馈,问题已在 v0.5.1 版本修复,v0.5.0 版本可使用 ./revsuit upgrade 命令自动更新。如发现问题仍然存在,可在本 issue 中继续反馈。祝好。

@Nintyhundred
Copy link

cool

@Li4n0 Li4n0 closed this as completed Sep 14, 2022
@Li4n0 Li4n0 added the good first issue Good for newcomers label Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants