public LoginOM ValidateAuthenticatorBySMSCode(ValidateLoginBySMSCodeIM im, string deviceNumber) { var user = CheckUser(im.CountryId, im.Cellphone); var prevVerifier = new LoginCellphoneVerifier(); var hadOpenedGoogleAuth = ValidationFlagComponent.CheckSecurityOpened(user.ValidationFlag, ValidationFlag.GooogleAuthenticator); var deviceList = new UserDeviceDAC().GetUserDeviceByAccountId(user.Id); if (!deviceList.Any()) { new ApplicationException(); } if (deviceList.All(item => item.DeviceNumber != deviceNumber)) { new ApplicationException(); } SecurityVerify.Verify(new GoogleVerifier(), SystemPlatform.FiiiPay, user.Id.ToString(), user.AuthSecretKey, im.GoogleCode); SecurityVerify.Verify <LoginBySMSVerify>(new CustomVerifier("LoginBySMS"), SystemPlatform.FiiiPay, user.Id.ToString(), (model) => { return(model.CellphoneVerified); }); var loginOm = IssueAccessToken(user); return(loginOm); }
public ServiceResult <LoginOM> ValidateLoginBySMSCode(ValidateLoginBySMSCodeIM im) { ServiceResult <LoginOM> result = new ServiceResult <LoginOM>(); string deviceNumber = this.GetDeviceNumber(); if (string.IsNullOrEmpty(deviceNumber)) { result.Code = ReasonCode.MISSING_REQUIRED_FIELDS; return(result); } result.Data = new UserAccountComponent().ValidateAuthenticatorBySMSCode(im, deviceNumber); return(result); }