🐛 fix session bug
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
// 处理用户信息
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user