mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 19:40:19 +08:00
feat: fix user cannot logout issue about bug in GetSessionToken()
This commit is contained in:
@ -45,7 +45,6 @@ func InitDb() {
|
||||
}
|
||||
|
||||
initWebAuthn()
|
||||
initToken()
|
||||
}
|
||||
|
||||
func getBuiltInAccountItems() []*AccountItem {
|
||||
@ -310,10 +309,6 @@ func initWebAuthn() {
|
||||
gob.Register(webauthn.SessionData{})
|
||||
}
|
||||
|
||||
func initToken() {
|
||||
gob.Register(&Token{})
|
||||
}
|
||||
|
||||
func initBuiltInUserModel() {
|
||||
model, err := GetModel("built-in/user-model-built-in")
|
||||
if err != nil {
|
||||
|
@ -727,18 +727,19 @@ func GetWechatMiniProgramToken(application *Application, code string, host strin
|
||||
return token, nil, nil
|
||||
}
|
||||
|
||||
func GetTokenForExtension(user *User, host string) (*Token, error) {
|
||||
func GetAccessTokenByUser(user *User, host string) (string, error) {
|
||||
application, err := GetApplicationByUser(user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", err
|
||||
}
|
||||
if application == nil {
|
||||
return nil, fmt.Errorf("the application for user %s is not found", user.Id)
|
||||
return "", fmt.Errorf("the application for user %s is not found", user.Id)
|
||||
}
|
||||
|
||||
token, err := GetTokenByUser(application, user, "profile", "", host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", err
|
||||
}
|
||||
return token, nil
|
||||
|
||||
return token.AccessToken, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user