refactor
This commit is contained in:
parent
3090e13be7
commit
622d4ac165
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
NOW = $(shell date -u '+%Y%m%d%I%M%S')
|
NOW = $(shell date -u '+%Y%m%d%I%M%S')
|
||||||
|
|
||||||
RELEASE_VERSION = 5.1.0
|
RELEASE_VERSION = 5.0.0
|
||||||
|
|
||||||
APP = n9e
|
APP = n9e
|
||||||
SERVER_BIN = ${APP}
|
SERVER_BIN = ${APP}
|
||||||
|
|
11
README.md
11
README.md
|
@ -1,7 +1,16 @@
|
||||||
## Intro
|
## 简介
|
||||||
|
|
||||||
Nightingale, Prometheus enterprise edition
|
Nightingale, Prometheus enterprise edition
|
||||||
|
|
||||||
|
## 注意
|
||||||
|
|
||||||
|
v5正式版还没发布,预计12月中旬发布
|
||||||
|
|
||||||
|
## 文档
|
||||||
|
|
||||||
|
- 国外:[https://n9e.github.io/](https://n9e.github.io/)
|
||||||
|
- 国内:[https://n9e.gitee.io/](https://n9e.gitee.io/)
|
||||||
|
- [v4老文档](https://gitee.com/n9e/book/tree/master/content/v4/docs)
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ func refreshPost(c *gin.Context) {
|
||||||
// if there is an error, the token must have expired
|
// if there is an error, the token must have expired
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// redirect to login page
|
// redirect to login page
|
||||||
ginx.NewRender(c).Message("refresh token expired")
|
ginx.NewRender(c, http.StatusUnauthorized).Message("refresh token expired")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,21 +101,21 @@ func refreshPost(c *gin.Context) {
|
||||||
refreshUuid, ok := claims["refresh_uuid"].(string) //convert the interface to string
|
refreshUuid, ok := claims["refresh_uuid"].(string) //convert the interface to string
|
||||||
if !ok {
|
if !ok {
|
||||||
// Theoretically impossible
|
// Theoretically impossible
|
||||||
ginx.NewRender(c).Message("failed to parse refresh_uuid from jwt")
|
ginx.NewRender(c, http.StatusUnauthorized).Message("failed to parse refresh_uuid from jwt")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
userIdentity, ok := claims["user_identity"].(string)
|
userIdentity, ok := claims["user_identity"].(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
// Theoretically impossible
|
// Theoretically impossible
|
||||||
ginx.NewRender(c).Message("failed to parse user_identity from jwt")
|
ginx.NewRender(c, http.StatusUnauthorized).Message("failed to parse user_identity from jwt")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the previous Refresh Token
|
// Delete the previous Refresh Token
|
||||||
err = deleteAuth(c.Request.Context(), refreshUuid)
|
err = deleteAuth(c.Request.Context(), refreshUuid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ginx.NewRender(c).Message(InternalServerError)
|
ginx.NewRender(c, http.StatusUnauthorized).Message(InternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,6 @@ func refreshPost(c *gin.Context) {
|
||||||
}, nil)
|
}, nil)
|
||||||
} else {
|
} else {
|
||||||
// redirect to login page
|
// redirect to login page
|
||||||
ginx.NewRender(c).Message("refresh token expired")
|
ginx.NewRender(c, http.StatusUnauthorized).Message("refresh token expired")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue