public static MembershipRebootConfiguration Create()
        {
            var settings = SecuritySettings.FromConfiguration();
            var config = new MembershipRebootConfiguration(settings);

            var appinfo = new AspNetApplicationInformation("Test", "Test Email Signature",
                "UserAccount/Login", 
                "UserAccount/Register/Confirm/",
                "UserAccount/Register/Cancel/",
                "UserAccount/PasswordReset/Confirm/",
                "UserAccount/ChangeEmail/Confirm/");
            var emailFormatter = new EmailMessageFormatter(appinfo);
            if (settings.RequireAccountVerification)
            {
                // uncomment if you want email notifications -- also update smtp settings in web.config
                //config.AddEventHandler(new EmailAccountCreatedEventHandler(emailFormatter));
            }
            // uncomment if you want email notifications -- also update smtp settings in web.config
            //config.AddEventHandler(new EmailAccountEventsHandler(emailFormatter));
            //config.AddEventHandler(new TwilloSmsEventHandler(appinfo));
            // set to false for production
            config.ConfigureAspNetCookieBasedTwoFactorAuthPolicy(debugging:true);

            // uncomment to ensure proper password complexity
            //config.ConfigurePasswordComplexity();
            
            return config;
        }
        public static MembershipRebootConfiguration Create()
        {
            var settings = SecuritySettings.Instance;
            var config = new MembershipRebootConfiguration(settings, new DelegateFactory(()=>new DefaultUserAccountRepository(settings.ConnectionStringName)));

            var appinfo = new Lazy<ApplicationInformation>(() =>
            {
                // build URL
                var baseUrl = HttpContext.Current.GetApplicationUrl();
                // area name
                baseUrl += "UserAccount/";

                return new ApplicationInformation
                {
                    ApplicationName = "Test",
                    LoginUrl = baseUrl + "Login",
                    VerifyAccountUrl = baseUrl + "Register/Confirm/",
                    CancelNewAccountUrl = baseUrl + "Register/Cancel/",
                    ConfirmPasswordResetUrl = baseUrl + "PasswordReset/Confirm/",
                    ConfirmChangeEmailUrl = baseUrl + "ChangeEmail/Confirm/"
                };
            });
            var emailFormatter = new EmailMessageFormatter(appinfo);
            if (settings.RequireAccountVerification)
            {
                //config.AddEventHandler(new EmailAccountCreatedEventHandler(emailFormatter));
            }
            //config.AddEventHandler(new EmailAccountEventsHandler(emailFormatter));
            config.AddEventHandler(new TwilloSmsEventHandler(appinfo));

            config.ConfigureAspNetCookieBasedTwoFactorAuthPolicy();
            
            return config;
        }
        public static MembershipRebootConfiguration Create()
        {
            var settings = SecuritySettings.FromConfiguration();
            var config   = new MembershipRebootConfiguration(settings);

            var appinfo = new AspNetApplicationInformation("Test", "Test Email Signature",
                                                           "UserAccount/Login",
                                                           "UserAccount/Register/Confirm/",
                                                           "UserAccount/Register/Cancel/",
                                                           "UserAccount/PasswordReset/Confirm/",
                                                           "UserAccount/ChangeEmail/Confirm/");
            var emailFormatter = new EmailMessageFormatter(appinfo);

            if (settings.RequireAccountVerification)
            {
                // uncomment if you want email notifications -- also update smtp settings in web.config
                //config.AddEventHandler(new EmailAccountCreatedEventHandler(emailFormatter));
            }
            // uncomment if you want email notifications -- also update smtp settings in web.config
            //config.AddEventHandler(new EmailAccountEventsHandler(emailFormatter));
            config.AddEventHandler(new TwilloSmsEventHandler(appinfo));
            config.ConfigureAspNetCookieBasedTwoFactorAuthPolicy();

            return(config);
        }
예제 #4
0
        public static MembershipRebootConfiguration Create()
        {
            var settings = SecuritySettings.Instance;
            var config   = new MembershipRebootConfiguration(settings, new DelegateFactory(() => new DefaultUserAccountRepository(settings.ConnectionStringName)));

            var appinfo = new Lazy <ApplicationInformation>(() =>
            {
                // build URL
                var baseUrl = HttpContext.Current.GetApplicationUrl();
                // area name
                baseUrl += "UserAccount/";

                return(new ApplicationInformation
                {
                    ApplicationName = "Test",
                    LoginUrl = baseUrl + "Login",
                    VerifyAccountUrl = baseUrl + "Register/Confirm/",
                    CancelNewAccountUrl = baseUrl + "Register/Cancel/",
                    ConfirmPasswordResetUrl = baseUrl + "PasswordReset/Confirm/",
                    ConfirmChangeEmailUrl = baseUrl + "ChangeEmail/Confirm/"
                });
            });
            var emailFormatter = new EmailMessageFormatter(appinfo);

            if (settings.RequireAccountVerification)
            {
                //config.AddEventHandler(new EmailAccountCreatedEventHandler(emailFormatter));
            }
            //config.AddEventHandler(new EmailAccountEventsHandler(emailFormatter));
            config.AddEventHandler(new TwilloSmsEventHandler(appinfo));

            config.ConfigureAspNetCookieBasedTwoFactorAuthPolicy();

            return(config);
        }
        public static MembershipRebootConfiguration Create()
        {
            var config = new MembershipRebootConfiguration();

            config.RequireAccountVerification = false;

            config.AddEventHandler(new DebuggerEventHandler());

            var appinfo = new AspNetApplicationInformation("Test", "Test Email Signature",
                                                           "UserAccount/Login",
                                                           "UserAccount/ChangeEmail/Confirm/",
                                                           "UserAccount/Register/Cancel/",
                                                           "UserAccount/PasswordReset/Confirm/");
            var emailFormatter = new EmailMessageFormatter(appinfo);

            // uncomment if you want email notifications -- also update smtp settings in web.config
            config.AddEventHandler(new EmailAccountEventsHandler(emailFormatter));
            //config.AddEventHandler(new TwilloSmsEventHandler(appinfo));
            // set to false for production
            config.ConfigureAspNetCookieBasedTwoFactorAuthPolicy(debugging: true);

            // uncomment to ensure proper password complexity
            //config.ConfigurePasswordComplexity();

            return(config);
        }