🐛 fix session bug

This commit is contained in:
landaiqing
2024-11-17 20:02:59 +08:00
parent 34c4690f80
commit 78a162a19a
72 changed files with 1304 additions and 453 deletions

View File

@@ -3,7 +3,6 @@ package oauth
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"strconv"
@@ -79,7 +78,7 @@ func (l *GithubCallbackLogic) GithubCallback(w http.ResponseWriter, r *http.Requ
}
if token == nil {
return errors.New("failed to get token")
return nil
}
// 获取用户信息
@@ -90,7 +89,7 @@ func (l *GithubCallbackLogic) GithubCallback(w http.ResponseWriter, r *http.Requ
}
if userInfo == nil {
return errors.New("failed to get user info")
return nil
}
// 处理用户信息

View File

@@ -3,7 +3,6 @@ package oauth
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"strconv"
@@ -75,7 +74,7 @@ func (l *QqCallbackLogic) QqCallback(w http.ResponseWriter, r *http.Request, req
return err
}
if token == nil {
return errors.New("get qq token failed")
return nil
}
// 通过 token 获取 openid

View File

@@ -61,9 +61,9 @@ func (l *WechatCallbackLogic) WechatCallback(w http.ResponseWriter, r *http.Requ
key := strings.TrimPrefix(msg.EventKey, "qrscene_")
err = l.HandlerWechatLogin(msg.FromUserName, key, w, r)
if err != nil {
return messages.NewText(i18n.FormatText(l.ctx, "login.loginFailed", "登录失败"))
return messages.NewText(i18n.FormatText(l.ctx, "login.loginFailed"))
}
return messages.NewText(i18n.FormatText(l.ctx, "login.loginSuccess", "登录成功"))
return messages.NewText(i18n.FormatText(l.ctx, "login.loginSuccess"))
case models.CALLBACK_EVENT_UNSUBSCRIBE:
msg := models.EventUnSubscribe{}
@@ -83,9 +83,9 @@ func (l *WechatCallbackLogic) WechatCallback(w http.ResponseWriter, r *http.Requ
}
err = l.HandlerWechatLogin(msg.FromUserName, msg.EventKey, w, r)
if err != nil {
return messages.NewText(i18n.FormatText(l.ctx, "login.loginFailed", "登录失败"))
return messages.NewText(i18n.FormatText(l.ctx, "login.loginFailed"))
}
return messages.NewText(i18n.FormatText(l.ctx, "login.loginSuccess", "登录成功"))
return messages.NewText(i18n.FormatText(l.ctx, "login.loginSuccess"))
}
@@ -101,11 +101,11 @@ func (l *WechatCallbackLogic) WechatCallback(w http.ResponseWriter, r *http.Requ
})
if err != nil {
panic(err)
return err
}
err = helper.HttpResponseSend(rs, w)
if err != nil {
panic(err)
return err
}
return nil
}