Ejemplo n.º 1
0
        public void SendUpdateNewEmailCode(Guid accountId, string emailAddress)
        {
            var dac     = new MerchantAccountDAC();
            var account = dac.GetById(accountId);

            if (account.Email == emailAddress)
            {
                throw new CommonException(ReasonCode.ORIGIN_NEW_EMAIL_SAME, Resources.新邮箱不能和原来的邮箱一致);
            }

            var accountByEmail = dac.GetByEmail(emailAddress);

            if (accountByEmail != null && accountByEmail.Id != accountId)
            {
                throw new CommonException(ReasonCode.EMAIL_BINDBYOTHER, Resources.此邮箱已经绑定到其他邮箱);
            }

            string subject = Resources.验证码邮箱标题;

            SecurityVerify.SendCode(new UpdateEmailNewVerifier(), SystemPlatform.FiiiPOS, accountId.ToString(), emailAddress, subject);
            var model = SecurityVerify.GetModel <FiiiPosUpdateEmailVerify>(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPOS, accountId.ToString());

            model.NewEmail = emailAddress;
            SecurityVerify.SetModel(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
Ejemplo n.º 2
0
        public void VerifyCloseCombine(Guid merchantId, string smsCode, string googleCode)
        {
            var merchant = new MerchantAccountDAC().GetById(merchantId);
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = merchant.ValidationFlag,
                GoogleAuthSecretKey = merchant.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPOS, merchant.Id.ToString(), userSecrets, options, null);

            var model = SecurityVerify.GetModel <CloseGoogleAuth>(new CustomVerifier("CloseGoogleAuth"), SystemPlatform.FiiiPOS, merchant.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("CloseGoogleAuth"), SystemPlatform.FiiiPOS, merchant.Id.ToString(), model);
        }
Ejemplo n.º 3
0
        public void VerifyModifyCellphoneCombine(Guid accountId, string smsCode, string googleCode)
        {
            MerchantAccount merchant = new MerchantAccountDAC().GetById(accountId);

            if (merchant == null)
            {
                throw new CommonException(ReasonCode.ACCOUNT_NOT_EXISTS, Resources.用户不存在);
            }
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = merchant.ValidationFlag,
                GoogleAuthSecretKey = merchant.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPOS, accountId.ToString(), userSecrets, options);

            var model = SecurityVerify.GetModel <ModifyCellphoneVerify>(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, accountId.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
Ejemplo n.º 4
0
        public void VerifyWithdrawCombine(Guid accountId, string smsCode, string googleCode, string divisionCode)
        {
            UserAccount user = new UserAccountDAC().GetById(accountId);
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = user.ValidationFlag,
                GoogleAuthSecretKey = user.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPay, user.Id.ToString(), userSecrets, options, divisionCode);

            var model = SecurityVerify.GetModel <WithdrawVerify>(new CustomVerifier("UserWithdraw"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("UserWithdraw"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Ejemplo n.º 5
0
        public void VerifyBindGoogleAuth(Guid accountId, string secretKey, string code)
        {
            SecurityVerify.Verify(new GoogleVerifier(), SystemPlatform.FiiiPOS, accountId.ToString(), secretKey, code);
            var model = SecurityVerify.GetModel <BindGoogleAuth>(new CustomVerifier("BindGoogleAuth"), SystemPlatform.FiiiPOS, accountId.ToString());

            model.GoogleVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("BindGoogleAuth"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
Ejemplo n.º 6
0
        public void VerifyModifyCellphoneSMS(Guid accountId, string smsCode)
        {
            SecurityVerify.Verify(new ModifyCellphoneVerifier(), SystemPlatform.FiiiPOS, accountId.ToString(), smsCode, true);
            var model = SecurityVerify.GetModel <ModifyCellphoneVerify>(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, accountId.ToString());

            model.NewCellphoneVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("ModifyCellphone"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
Ejemplo n.º 7
0
        public void VerifyNewEmail(Guid accountId, string code)
        {
            SecurityVerify.Verify(new UpdateEmailNewVerifier(), SystemPlatform.FiiiPOS, accountId.ToString(), code);
            var model = SecurityVerify.GetModel <FiiiPosUpdateEmailVerify>(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPOS, accountId.ToString());

            model.NewEmailVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPOS, accountId.ToString(), model);
        }
Ejemplo n.º 8
0
        public void VerifyUpdateEmailPin(UserAccount user, string pin)
        {
            SecurityVerify.Verify(new PinVerifier(), SystemPlatform.FiiiPay, user.Id.ToString(), user.Pin, pin);
            var model = SecurityVerify.GetModel <UpdateEmailVerify>(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.PinVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 验证新邮箱
        /// </summary>
        /// <param name="user"></param>
        /// <param name="email"></param>
        /// <param name="code"></param>
        public void VerifyNewEmail(UserAccount user, string email, string code)
        {
            SecurityVerify.Verify(new UpdateEmailNewVerifier(), SystemPlatform.FiiiPay, user.Id.ToString(), code);
            var model = SecurityVerify.GetModel <UpdateEmailVerify>(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.NewEmailVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("UpdateEmail"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Ejemplo n.º 10
0
        public void VerifyUpdateCellphoneNewCode(UserAccount user, VerifyUpdateCellphoneNewCodeIM im)
        {
            SecurityVerify.Verify(new UpdateCellphoneNewVerifier(), SystemPlatform.FiiiPay, user.Id.ToString(), im.Code);

            var model = SecurityVerify.GetModel <UpdateCellphoneVerify>(new CustomVerifier("UpdateCellphone"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.NewCellphoneVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("UpdateCellphone"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Ejemplo n.º 11
0
        public void VerifySetEmailPin(Guid accountId, string pin)
        {
            var account = new MerchantAccountDAC().GetById(accountId);

            SecurityVerify.Verify(new PinVerifier(), SystemPlatform.FiiiPOS, account.Id.ToString(), account.PIN, pin);
            var model = SecurityVerify.GetModel <FiiiPosSetEmailVerify>(new CustomVerifier("SetEmail"), SystemPlatform.FiiiPOS, account.Id.ToString());

            model.PinVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("SetEmail"), SystemPlatform.FiiiPOS, account.Id.ToString(), model);
        }
Ejemplo n.º 12
0
        public void VerifyGoogleAuthByMerchantAccount(string googleCode, string merchantAccount)
        {
            var dac     = new MerchantAccountDAC();
            var account = dac.GetByUsername(merchantAccount);

            SecurityVerify.Verify(new GoogleVerifier(), SystemPlatform.FiiiPOS, account.Id.ToString(), account.AuthSecretKey, googleCode);
            var model = SecurityVerify.GetModel <BindAccountVerify>(new CustomVerifier("BindAccount"), SystemPlatform.FiiiPOS, merchantAccount);

            model.GoogleVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("BindAccount"), SystemPlatform.FiiiPOS, merchantAccount, model);
        }
Ejemplo n.º 13
0
        public void VerifyPINByMerchantAccount(string pin, string merchantAccount)
        {
            var dac     = new MerchantAccountDAC();
            var account = dac.GetByUsername(merchantAccount);

            SecurityVerify.Verify(new PinVerifier(), SystemPlatform.FiiiPOS, account.Id.ToString(), account.PIN, pin);
            var model = SecurityVerify.GetModel <BindAccountVerify>(new CustomVerifier("BindAccount"), SystemPlatform.FiiiPOS, merchantAccount);

            model.PinVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("BindAccount"), SystemPlatform.FiiiPOS, merchantAccount, model);
        }
Ejemplo n.º 14
0
        public void VerifySetEmailCode(Guid accountId, string code)
        {
            var account = new MerchantAccountDAC().GetById(accountId);

            if (!string.IsNullOrEmpty(account.Email))
            {
                throw new ApplicationException();
            }

            SecurityVerify.Verify(new SetEmailVerifier(), SystemPlatform.FiiiPOS, account.Id.ToString(), code);
            var model = SecurityVerify.GetModel <FiiiPosSetEmailVerify>(new CustomVerifier("SetEmail"), SystemPlatform.FiiiPOS, account.Id.ToString());

            model.EmailVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("SetEmail"), SystemPlatform.FiiiPOS, account.Id.ToString(), model);
        }
Ejemplo n.º 15
0
        public void VerifyBindCombine(UserAccount user, string smsCode)
        {
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag = user.ValidationFlag
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPay, user.Id.ToString(), userSecrets, options, null);

            var model = SecurityVerify.GetModel <BindGoogleAuth>(new CustomVerifier("BindGoogleAuth"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("BindGoogleAuth"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }
Ejemplo n.º 16
0
        public void VerifyUpdateCellphoneCombine(UserAccount user, string smsCode, string googleCode)
        {
            List <CombinedVerifyOption> options = new List <CombinedVerifyOption>
            {
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.Cellphone, Code = smsCode
                },
                new CombinedVerifyOption {
                    AuthType = (byte)ValidationFlag.GooogleAuthenticator, Code = googleCode
                }
            };
            UserSecrets userSecrets = new UserSecrets
            {
                ValidationFlag      = user.ValidationFlag,
                GoogleAuthSecretKey = user.AuthSecretKey
            };

            SecurityVerify.CombinedVerify(SystemPlatform.FiiiPay, user.Id.ToString(), userSecrets, options);

            var model = SecurityVerify.GetModel <UpdateCellphoneVerify>(new CustomVerifier("UpdateCellphone"), SystemPlatform.FiiiPay, user.Id.ToString());

            model.CombinedVerified = true;
            SecurityVerify.SetModel(new CustomVerifier("UpdateCellphone"), SystemPlatform.FiiiPay, user.Id.ToString(), model);
        }