public LoginOM NewDeviceLogin(NewDeviceLoginIM im, string deviceNumber) { var user = CheckUser(im.CountryId, im.Cellphone, im.Password); var customVerifier = new CustomVerifier("NewDeviceLogin"); SecurityVerify.SetModel(customVerifier, SystemPlatform.FiiiPay, user.Id.ToString(), new NewDeviceLogin()); SecurityVerify.Verify <NewDeviceLogin>(customVerifier, SystemPlatform.FiiiPay, user.Id.ToString(), (m) => { bool result = true; if (user.L1VerifyStatus == VerifyStatus.Certified) { var identityNo = new UserProfileComponent().PreVerifyLv1(user).IdentityDocNo; result = result && new IDNumberVerifier().Verify(SystemPlatform.FiiiPay, user.Id.ToString(), identityNo, im.IdentityDocNo); if (!result) { var errorCountKey = customVerifier.GetErrorCountKey(SystemPlatform.FiiiPay, user.Id.ToString()); var errorCount = SecurityVerify.CheckErrorCount(customVerifier, errorCountKey); new IDNumberVerifier().VerifyFaild(Constant.VIRIFY_FAILD_TIMES_LIMIT - errorCount - 1); } } if (!string.IsNullOrEmpty(user.Pin)) { result = result && new PinVerifier().Verify(SystemPlatform.FiiiPay, user.Id.ToString(), user.Pin, AES128.Decrypt(im.Pin, AES128.DefaultKey)); if (!result) { var errorCountKey = customVerifier.GetErrorCountKey(SystemPlatform.FiiiPay, user.Id.ToString()); var errorCount = SecurityVerify.CheckErrorCount(customVerifier, errorCountKey); new PinVerifier().VerifyFaild(Constant.VIRIFY_FAILD_TIMES_LIMIT - errorCount - 1); } } if (SecurityVerify.CheckSecurityOpened(user.ValidationFlag, ValidationFlag.GooogleAuthenticator)) { var googleVerifier = new GoogleVerifier(); if (string.IsNullOrEmpty(im.GoogleCode)) { result = false; } result = result && SecurityVerify.CheckCodeValid(googleVerifier, SystemPlatform.FiiiPay, user.Id.ToString(), im.GoogleCode); result = result && googleVerifier.Verify(user.AuthSecretKey, im.GoogleCode); if (!result) { var errorCountKey = customVerifier.GetErrorCountKey(SystemPlatform.FiiiPay, user.Id.ToString()); var errorCount = SecurityVerify.CheckErrorCount(customVerifier, errorCountKey); googleVerifier.VerifyFaild(Constant.VIRIFY_FAILD_TIMES_LIMIT - errorCount - 1); } } return(result); }); new UserDeviceDAC().Insert(new UserDevice() { DeviceNumber = deviceNumber, Name = " ", UserAccountId = user.Id, LastActiveTime = DateTime.UtcNow }); return(IssueAccessToken(user)); }