diff --git a/routers/user/Invitation.go b/routers/user/Invitation.go index 0fa8cd4ed..8491390b2 100644 --- a/routers/user/Invitation.go +++ b/routers/user/Invitation.go @@ -63,14 +63,14 @@ func InviationTpl(ctx *context.Context) { ctx.HTML(200, tplInvitation) } -func RegisteUserByInvitaionCode(invitationcode string, newUserId int64) error { +func RegisteUserByInvitaionCode(invitationcode string, newUserId int64, newPhoneNumber string) error { user := parseInvitaionCode(invitationcode) if user == nil { return errors.New("The invitated user not existed.") } - if user.PhoneNumber != "" { - re := models.QueryInvitaionByPhone(user.PhoneNumber) + if newPhoneNumber != "" { + re := models.QueryInvitaionByPhone(newPhoneNumber) if re != nil { if len(re) > 0 { log.Info("The phone has been invitated. so ingore it.") @@ -84,7 +84,7 @@ func RegisteUserByInvitaionCode(invitationcode string, newUserId int64) error { invitation := &models.Invitation{ SrcUserID: user.ID, UserID: newUserId, - Phone: user.PhoneNumber, + Phone: newPhoneNumber, } err := models.InsertInvitaion(invitation) diff --git a/routers/user/auth.go b/routers/user/auth.go index fb8674da0..57ffb1710 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -1368,7 +1368,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo log.Info("enter here, and form.InvitaionCode =" + invitationCode) if invitationCode != "" { - RegisteUserByInvitaionCode(invitationCode, u.ID) + RegisteUserByInvitaionCode(invitationCode, u.ID, u.PhoneNumber) } err := models.AddEmailAddress(&models.EmailAddress{