Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Registering users through ”/account/register“ will cause chat rpc to fail #529

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/openimsdk/chat

go 1.21.2

toolchain go1.21.9

require (
github.com/gin-gonic/gin v1.9.1
github.com/golang-jwt/jwt/v4 v4.5.0
Expand All @@ -25,7 +27,7 @@ require (
require (
github.com/livekit/protocol v1.10.1
github.com/mitchellh/mapstructure v1.5.0
github.com/openimsdk/gomake v0.0.9
github.com/openimsdk/gomake v0.0.11
github.com/openimsdk/protocol v0.0.63
github.com/openimsdk/tools v0.0.49-alpha.3
github.com/redis/go-redis/v9 v9.5.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ github.com/nats-io/nkeys v0.4.6/go.mod h1:4DxZNzenSVd1cYQoAa8948QY3QDjrHfcfVADym
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/openimsdk/gomake v0.0.9 h1:ouf25ygN2PMQ68Gfgns/EQRPiLPnp+77SIr68GfE+n4=
github.com/openimsdk/gomake v0.0.9/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
github.com/openimsdk/gomake v0.0.11 h1:jJ9286zKFfBeARkmfqMEcUYg9lJ+Cj9lylxP8W9uCFM=
github.com/openimsdk/gomake v0.0.11/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
github.com/openimsdk/protocol v0.0.63 h1:9DnweZe9nEYDFa4fGTbC9Cqi0gLUdtBhRo1NRP2X3WQ=
github.com/openimsdk/protocol v0.0.63/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8=
github.com/openimsdk/tools v0.0.49-alpha.3 h1:mXKU09asKTLjj0yCsfqqMizs3ibl1vLimW7ZYzAMw44=
Expand Down
6 changes: 3 additions & 3 deletions internal/rpc/chat/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (o *chatSvr) SendVerifyCode(ctx context.Context, req *chat.SendVerifyCodeRe
if req.AreaCode == "" || req.PhoneNumber == "" {
return nil, errs.ErrArgs.WrapMsg("area code or phone number is empty")
}
if req.AreaCode[0] != '+' {
if !strings.HasPrefix(req.AreaCode, "+") {
req.AreaCode = "+" + req.AreaCode
}
if _, err := strconv.ParseUint(req.AreaCode[1:], 10, 64); err != nil {
Expand Down Expand Up @@ -313,7 +313,7 @@ func (o *chatSvr) RegisterUser(ctx context.Context, req *chat.RegisterUserReq) (
}
var registerType int32
if req.User.PhoneNumber != "" {
if req.User.AreaCode[0] != '+' {
if !strings.HasPrefix(req.User.AreaCode, "+") {
req.User.AreaCode = "+" + req.User.AreaCode
}
if _, err := strconv.ParseUint(req.User.AreaCode[1:], 10, 64); err != nil {
Expand Down Expand Up @@ -415,7 +415,7 @@ func (o *chatSvr) Login(ctx context.Context, req *chat.LoginReq) (*chat.LoginRes
if req.AreaCode == "" {
return nil, errs.ErrArgs.WrapMsg("area code must")
}
if req.AreaCode[0] != '+' {
if !strings.HasPrefix(req.AreaCode, "+") {
req.AreaCode = "+" + req.AreaCode
}
if _, err := strconv.ParseUint(req.AreaCode[1:], 10, 64); err != nil {
Expand Down
20 changes: 0 additions & 20 deletions pkg/protocol/admin/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import "sdkws/sdkws.proto";
import "common/common.proto";
option go_package = "github.com/openimsdk/chat/pkg/protocol/admin";

//登录
message LoginReq {
string account = 1;
string password = 2;
Expand Down Expand Up @@ -103,8 +102,6 @@ message GetAdminInfoResp {
int64 createTime = 8;
}

// ################### 默认好友 ###################

message AddDefaultFriendReq {
repeated string userIDs = 1;
}
Expand Down Expand Up @@ -139,9 +136,6 @@ message SearchDefaultFriendResp {
repeated DefaultFriendAttribute users = 2;
}

// ################### 默认群组 ###################


message AddDefaultGroupReq {
repeated string groupIDs = 1;
}
Expand Down Expand Up @@ -176,8 +170,6 @@ message SearchDefaultGroupResp {
repeated string groupIDs = 2;
}

// ################### 邀请码 ###################

message AddInvitationCodeReq {
repeated string codes = 1;
}
Expand Down Expand Up @@ -237,8 +229,6 @@ message SearchInvitationCodeResp {
repeated InvitationRegister list = 2;
}

// ################### 用户登录ip限制 ###################

message SearchUserIPLimitLoginReq {
string keyword = 1;
openim.sdkws.RequestPagination pagination = 2;
Expand Down Expand Up @@ -275,9 +265,6 @@ message DelUserIPLimitLoginReq {
message DelUserIPLimitLoginResp {
}


// ################### 用户IP限制 ###################

message IPForbidden {
string ip = 1;
bool limitRegister = 2;
Expand Down Expand Up @@ -312,7 +299,6 @@ message DelIPForbiddenReq {
}
message DelIPForbiddenResp {}

// ################### 用户限制 ###################
message CheckRegisterForbiddenReq {
string ip = 1;
}
Expand All @@ -328,15 +314,13 @@ message CheckLoginForbiddenReq {
message CheckLoginForbiddenResp {
}

// ################### 注销 ###################
message CancellationUserReq{
string userID = 1;
string reason = 2;
}

message CancellationUserResp {}

// ################### 封号、解封 ###################
message BlockUserReq{
string userID = 1;
string reason = 2;
Expand Down Expand Up @@ -392,8 +376,6 @@ message FindUserBlockInfoResp{
repeated BlockInfo blocks = 2;
}

// ################### TOKEN ###################

message CreateTokenReq{
string userID = 2;
int32 userType = 3;
Expand All @@ -413,8 +395,6 @@ message ParseTokenResp{
int64 expireTimeSeconds = 4;
}

// ################### 小程序 ###################

message AddAppletReq {
string id = 1;
string name = 2;
Expand Down
Loading
Loading