public bool H5Register(H5RegisterIM im) { if (im.Cellphone.StartsWith("170") || im.Cellphone.StartsWith("171")) { throw new CommonException(ReasonCode.PhoneNumber_Invalid, MessageResources.InvalidCellphone); } var verifier = new RegisterCellphoneVerifier(); SecurityVerify.Verify(verifier, SystemPlatform.FiiiPay, $"{im.CountryId}:{im.Cellphone}", im.SMSCode, true); var accountDAC = new UserAccountDAC(); if (!IsNullOrEmpty(im.InviterCode) && !accountDAC.ExistInviterCode(im.InviterCode)) { throw new CommonException(ReasonCode.INVITORCODE_NOT_EXISTS, MessageResources.InvalidInvitation); } if (!AccountUseable(im.CountryId, im.Cellphone)) { throw new CommonException(ReasonCode.ACCOUNT_EXISTS, Format(MessageResources.AccountAlreadyExist, im.Cellphone)); } bool result = Register(im.CountryId, im.Cellphone, im.Password, im.InviterCode); if (result) { SecurityVerify.InvalidateCode(verifier, SystemPlatform.FiiiPay, $"{im.CountryId}:{im.Cellphone}"); } return(result); }
public ServiceResult <bool> H5Register(RegisterModel model) { ServiceResult <bool> result = new ServiceResult <bool>(); var im = new H5RegisterIM { CountryId = model.CountryId, Cellphone = model.Cellphone, Password = model.Password, SMSCode = model.SMSCode, InviterCode = model.InviterCode }; result.Data = new UserAccountComponent().H5Register(im); return(result); }