Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f72b227

Browse files
committed
支持 jsonp
1 parent 01a199b commit f72b227

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

http/controller/base.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ func success(ctx echo.Context, data interface{}) error {
6464

6565
ctx.Response().Header().Add("ETag", newETag)
6666

67+
callback := ctx.QueryParam("callback")
68+
if callback != "" {
69+
return ctx.JSONPBlob(http.StatusOK, callback, b)
70+
}
71+
6772
return ctx.JSONBlob(http.StatusOK, b)
6873
}
6974

logic/third_user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ func (self ThirdUserLogic) LoginFromGitea(ctx context.Context, code string) (*mo
258258
exists := DefaultUser.EmailOrUsernameExists(ctx, giteaUser.Email, giteaUser.UserName)
259259
if exists {
260260
// TODO: 考虑改进?
261-
objLog.Errorln("LoginFromGithub Github 对应的用户信息被占用")
262-
return nil, errors.New("Github 对应的用户信息被占用,可能你注册过本站,用户名密码登录试试!")
261+
objLog.Errorln("LoginFromGitea Gitea 对应的用户信息被占用")
262+
return nil, errors.New("Gitea 对应的用户信息被占用,可能你注册过本站,用户名密码登录试试!")
263263
}
264264

265265
session := MasterDB.NewSession()

0 commit comments

Comments
 (0)