示例#1
0
        public virtual void RegisterTwoFactorProviders(int?tenantId)
        {
            TwoFactorProviders.Clear();

            if (!IsTrue(AbpZeroSettingNames.UserManagement.TwoFactorLogin.IsEnabled, tenantId))
            {
                return;
            }

            if (EmailService != null &&
                IsTrue(AbpZeroSettingNames.UserManagement.TwoFactorLogin.IsEmailProviderEnabled, tenantId))
            {
                RegisterTwoFactorProvider(
                    L("Email"),
                    new EmailTokenProvider <TUser, long>
                {
                    Subject    = L("EmailSecurityCodeSubject"),
                    BodyFormat = L("EmailSecurityCodeBody")
                }
                    );
            }

            if (SmsService != null &&
                IsTrue(AbpZeroSettingNames.UserManagement.TwoFactorLogin.IsSmsProviderEnabled, tenantId))
            {
                RegisterTwoFactorProvider(
                    L("Sms"),
                    new PhoneNumberTokenProvider <TUser, long>
                {
                    MessageFormat = L("SmsSecurityCodeMessage")
                }
                    );
            }
        }
        public virtual void RegisterTwoFactorProviders()
        {
            TwoFactorProviders.Clear();

            if (false)
            {
                RegisterTwoFactorProvider(
                    "邮箱",
                    new EmailTokenProvider <TUser, long>
                {
                    Subject    = "安全码",
                    BodyFormat = "您的安全码是: {0}"
                }
                    );
            }

            if (false)
            {
                RegisterTwoFactorProvider(
                    "短信",
                    new PhoneNumberTokenProvider <TUser, long>
                {
                    MessageFormat = "您的短信验证码是: {0}"
                }
                    );
            }
        }