增加批量导入资产功能
This commit is contained in:
@ -91,7 +91,7 @@ func LoginSuccess(c echo.Context, loginAccount LoginAccount, user model.User) (t
|
||||
User: user,
|
||||
}
|
||||
|
||||
cacheKey := strings.Join([]string{Token, token}, ":")
|
||||
cacheKey := BuildCacheKeyByToken(token)
|
||||
|
||||
if authorization.Remember {
|
||||
// 记住登录有效期两周
|
||||
@ -119,6 +119,16 @@ func LoginSuccess(c echo.Context, loginAccount LoginAccount, user model.User) (t
|
||||
return token, nil
|
||||
}
|
||||
|
||||
func BuildCacheKeyByToken(token string) string {
|
||||
cacheKey := strings.Join([]string{Token, token}, ":")
|
||||
return cacheKey
|
||||
}
|
||||
|
||||
func GetTokenFormCacheKey(cacheKey string) string {
|
||||
token := strings.Split(cacheKey, ":")[1]
|
||||
return token
|
||||
}
|
||||
|
||||
func loginWithTotpEndpoint(c echo.Context) error {
|
||||
var loginAccount LoginAccount
|
||||
if err := c.Bind(&loginAccount); err != nil {
|
||||
@ -165,7 +175,7 @@ func loginWithTotpEndpoint(c echo.Context) error {
|
||||
|
||||
func LogoutEndpoint(c echo.Context) error {
|
||||
token := GetToken(c)
|
||||
cacheKey := strings.Join([]string{Token, token}, ":")
|
||||
cacheKey := BuildCacheKeyByToken(token)
|
||||
global.Cache.Delete(cacheKey)
|
||||
model.Logout(token)
|
||||
return Success(c, nil)
|
||||
|
Reference in New Issue
Block a user