mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
session list only shows unexpired normal sessions
This commit is contained in:
@@ -46,6 +46,19 @@ func (s *TokenService) GetAllTokensByUid(uid int64) ([]*models.TokenRecord, erro
|
||||
return tokenRecords, err
|
||||
}
|
||||
|
||||
func (s *TokenService) GetAllUnexpiredMormalTokensByUid(uid int64) ([]*models.TokenRecord, error) {
|
||||
if uid <= 0 {
|
||||
return nil, errs.ErrUserIdInvalid
|
||||
}
|
||||
|
||||
now := time.Now().Unix()
|
||||
|
||||
var tokenRecords []*models.TokenRecord
|
||||
err := s.TokenDB(uid).Cols("uid", "user_token_id", "token_type", "user_agent", "created_unix_time", "expired_unix_time").Where("uid=? AND token_type=? AND expired_unix_time>?", uid, core.USER_TOKEN_TYPE_NORMAL, now).OrderBy("created_unix_time desc").Find(&tokenRecords)
|
||||
|
||||
return tokenRecords, err
|
||||
}
|
||||
|
||||
func (s *TokenService) ParseToken(c *core.Context) (*jwt.Token, *core.UserTokenClaims, error) {
|
||||
claims := &core.UserTokenClaims{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user