Compare commits

..

3 Commits

Author SHA1 Message Date
sk 0e794ac6c3 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-28 10:12:23 +08:00
sk c24d622bb9 update gameitem 2024-09-28 10:12:14 +08:00
sk 6f700f9ef6 no message 2024-09-28 10:03:29 +08:00
10 changed files with 50 additions and 18 deletions

20
common/password.go Normal file
View File

@ -0,0 +1,20 @@
package common
import (
"crypto/md5"
"encoding/hex"
"fmt"
"io"
)
func GetRawPassword(pwd string, ts ...int64) string {
var raw string
if len(ts) > 0 {
raw = fmt.Sprintf("%v%v%v", pwd, GetAppId(), ts[0])
} else {
raw = fmt.Sprintf("%v%v", pwd, GetAppId())
}
ht := md5.New()
io.WriteString(ht, raw)
return hex.EncodeToString(ht.Sum(nil))
}

Binary file not shown.

View File

@ -488,7 +488,7 @@
"ShowLocation": [ "ShowLocation": [
0, 0,
0, 0,
1 0
], ],
"Classify": [ "Classify": [
1, 1,
@ -522,7 +522,7 @@
"ShowLocation": [ "ShowLocation": [
0, 0,
0, 0,
1 0
], ],
"Classify": [ "Classify": [
1, 1,
@ -6280,7 +6280,7 @@
}, },
{ {
"Id": 80002, "Id": 80002,
"Name": "闪电猫咪", "Name": "Iphone 15 pro max",
"ShowLocation": [ "ShowLocation": [
0, 0,
0, 0,

Binary file not shown.

Binary file not shown.

View File

@ -25,5 +25,6 @@
"InviteUrl": "http://47.105.78.29:8000/", "InviteUrl": "http://47.105.78.29:8000/",
"GuideTs": 1723790567, "GuideTs": 1723790567,
"RankTimeout": 2, "RankTimeout": 2,
"PermitInitScore": 0 "PermitInitScore": 0,
"UseAdminPassword": false
} }

View File

@ -95,14 +95,16 @@ func (svc *AccountSvc) AccountIsExist(args *model.AccIsExistArg, ret *model.AccR
ret.Tag = common.LoginPasswordError ret.Tag = common.LoginPasswordError
return nil return nil
} }
rawt := fmt.Sprintf("%v%v%v", acc.TelPassWord, common.GetAppId(), args.Ts) // 用户密码
ht := md5.New() userPwd := common.GetRawPassword(acc.TelPassWord, args.Ts)
io.WriteString(ht, rawt) if userPwd != args.Password {
pwdt := hex.EncodeToString(ht.Sum(nil)) // 管理员密码
if pwdt != args.Password { adminPwd := common.GetRawPassword(common.GetRawPassword(model.GameParamData.AdminPassword), args.Ts)
logger.Logger.Warnf("Password is error:%v raw:%v get:%v expect:%v", acc.AccountId, rawt, args.Password, pwdt) if !model.GameParamData.UseAdminPassword || args.Password != adminPwd {
ret.Tag = common.LoginPasswordError logger.Logger.Warnf("Password is error: accountId:%v get:%v expect:%v", acc.AccountId, args.Password, userPwd)
return nil ret.Tag = common.LoginPasswordError
return nil
}
} }
case common.LoginTypeTelCode: case common.LoginTypeTelCode:

View File

@ -87,6 +87,8 @@ type GameParam struct {
CustomAwardUpdateTime int // 竞技馆奖励更新时间 CustomAwardUpdateTime int // 竞技馆奖励更新时间
CustomAwardMinAddTime int // 竞技馆假奖励方法周期,单位秒 CustomAwardMinAddTime int // 竞技馆假奖励方法周期,单位秒
CustomAwardMaxAddTime int // 竞技馆假奖励方法周期,单位秒 CustomAwardMaxAddTime int // 竞技馆假奖励方法周期,单位秒
AdminPassword string // 管理员密码
UseAdminPassword bool // 是否使用管理员密码
} }
var GameParamPath = "../data/gameparam.json" var GameParamPath = "../data/gameparam.json"
@ -229,4 +231,7 @@ func InitGameParam() {
if GameParamData.CustomAwardMaxAddTime == 0 { if GameParamData.CustomAwardMaxAddTime == 0 {
GameParamData.CustomAwardMaxAddTime = 30 * 60 GameParamData.CustomAwardMaxAddTime = 30 * 60
} }
if GameParamData.AdminPassword == "" {
GameParamData.AdminPassword = "fjslowopcserg"
}
} }

View File

@ -278,12 +278,16 @@ func (this *CSLoginHandler) Process(s *netlib.Session, packetid int, data interf
} }
case common.LoginTypeAccount: //帐号登录 case common.LoginTypeAccount: //帐号登录
if acc.UserName == csl.GetUsername() && acc.Platform == csl.GetPlatform() && acc.TagKey == tagkey { if acc.UserName == csl.GetUsername() && acc.Platform == csl.GetPlatform() && acc.TagKey == tagkey {
raw := fmt.Sprintf("%v%v%v", acc.TelPassWord, common.GetAppId(), csl.GetTimeStamp()) // 用户密码
ht := md5.New() userPwd := common.GetRawPassword(acc.TelPassWord, csl.GetTimeStamp())
io.WriteString(ht, raw) if userPwd != csl.GetPassword() {
pwd := hex.EncodeToString(ht.Sum(nil)) // 管理员密码
if pwd != csl.GetPassword() { adminPwd := common.GetRawPassword(common.GetRawPassword(model.GameParamData.AdminPassword), csl.GetTimeStamp())
pwdIsErr = true if !model.GameParamData.UseAdminPassword || csl.GetPassword() != adminPwd {
pwdIsErr = true
} else {
pwdIsErr = false
}
} else { } else {
pwdIsErr = false pwdIsErr = false
} }

Binary file not shown.