| @@ -0,0 +1,109 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Data.Entity; | ||
| using System.Linq; | ||
| using System.Security.Claims; | ||
| using System.Threading.Tasks; | ||
| using System.Web; | ||
| using Microsoft.AspNet.Identity; | ||
| using Microsoft.AspNet.Identity.EntityFramework; | ||
| using Microsoft.AspNet.Identity.Owin; | ||
| using Microsoft.Owin; | ||
| using Microsoft.Owin.Security; | ||
| using WebApplication1.Models; | ||
|
|
||
| namespace WebApplication1 | ||
| { | ||
| public class EmailService : IIdentityMessageService | ||
| { | ||
| public Task SendAsync(IdentityMessage message) | ||
| { | ||
| // Plug in your email service here to send an email. | ||
| return Task.FromResult(0); | ||
| } | ||
| } | ||
|
|
||
| public class SmsService : IIdentityMessageService | ||
| { | ||
| public Task SendAsync(IdentityMessage message) | ||
| { | ||
| // Plug in your SMS service here to send a text message. | ||
| return Task.FromResult(0); | ||
| } | ||
| } | ||
|
|
||
| // Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application. | ||
| public class ApplicationUserManager : UserManager<ApplicationUser> | ||
| { | ||
| public ApplicationUserManager(IUserStore<ApplicationUser> store) | ||
| : base(store) | ||
| { | ||
| } | ||
|
|
||
| public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context) | ||
| { | ||
| var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>())); | ||
| // Configure validation logic for usernames | ||
| manager.UserValidator = new UserValidator<ApplicationUser>(manager) | ||
| { | ||
| AllowOnlyAlphanumericUserNames = false, | ||
| RequireUniqueEmail = true | ||
| }; | ||
|
|
||
| // Configure validation logic for passwords | ||
| manager.PasswordValidator = new PasswordValidator | ||
| { | ||
| RequiredLength = 6, | ||
| RequireNonLetterOrDigit = true, | ||
| RequireDigit = true, | ||
| RequireLowercase = true, | ||
| RequireUppercase = true, | ||
| }; | ||
|
|
||
| // Configure user lockout defaults | ||
| manager.UserLockoutEnabledByDefault = true; | ||
| manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5); | ||
| manager.MaxFailedAccessAttemptsBeforeLockout = 5; | ||
|
|
||
| // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user | ||
| // You can write your own provider and plug it in here. | ||
| manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ApplicationUser> | ||
| { | ||
| MessageFormat = "Your security code is {0}" | ||
| }); | ||
| manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ApplicationUser> | ||
| { | ||
| Subject = "Security Code", | ||
| BodyFormat = "Your security code is {0}" | ||
| }); | ||
| manager.EmailService = new EmailService(); | ||
| manager.SmsService = new SmsService(); | ||
| var dataProtectionProvider = options.DataProtectionProvider; | ||
| if (dataProtectionProvider != null) | ||
| { | ||
| manager.UserTokenProvider = | ||
| new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity")); | ||
| } | ||
| return manager; | ||
| } | ||
| } | ||
|
|
||
| // Configure the application sign-in manager which is used in this application. | ||
| public class ApplicationSignInManager : SignInManager<ApplicationUser, string> | ||
| { | ||
| public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager) | ||
| : base(userManager, authenticationManager) | ||
| { | ||
| } | ||
|
|
||
| public override Task<ClaimsIdentity> CreateUserIdentityAsync(ApplicationUser user) | ||
| { | ||
| return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager); | ||
| } | ||
|
|
||
| public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context) | ||
| { | ||
| return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,23 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Web; | ||
| using System.Web.Mvc; | ||
| using System.Web.Routing; | ||
|
|
||
| namespace WebApplication1 | ||
| { | ||
| public class RouteConfig | ||
| { | ||
| public static void RegisterRoutes(RouteCollection routes) | ||
| { | ||
| routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); | ||
|
|
||
| routes.MapRoute( | ||
| name: "Default", | ||
| url: "{controller}/{action}/{id}", | ||
| defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } | ||
| ); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,68 @@ | ||
| using System; | ||
| using Microsoft.AspNet.Identity; | ||
| using Microsoft.AspNet.Identity.Owin; | ||
| using Microsoft.Owin; | ||
| using Microsoft.Owin.Security.Cookies; | ||
| using Microsoft.Owin.Security.Google; | ||
| using Owin; | ||
| using WebApplication1.Models; | ||
|
|
||
| namespace WebApplication1 | ||
| { | ||
| public partial class Startup | ||
| { | ||
| // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864 | ||
| public void ConfigureAuth(IAppBuilder app) | ||
| { | ||
| // Configure the db context, user manager and signin manager to use a single instance per request | ||
| app.CreatePerOwinContext(ApplicationDbContext.Create); | ||
| app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); | ||
| app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create); | ||
|
|
||
| // Enable the application to use a cookie to store information for the signed in user | ||
| // and to use a cookie to temporarily store information about a user logging in with a third party login provider | ||
| // Configure the sign in cookie | ||
| app.UseCookieAuthentication(new CookieAuthenticationOptions | ||
| { | ||
| AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, | ||
| LoginPath = new PathString("/Account/Login"), | ||
| Provider = new CookieAuthenticationProvider | ||
| { | ||
| // Enables the application to validate the security stamp when the user logs in. | ||
| // This is a security feature which is used when you change a password or add an external login to your account. | ||
| OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>( | ||
| validateInterval: TimeSpan.FromMinutes(30), | ||
| regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) | ||
| } | ||
| }); | ||
| app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); | ||
|
|
||
| // Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process. | ||
| app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5)); | ||
|
|
||
| // Enables the application to remember the second login verification factor such as phone or email. | ||
| // Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from. | ||
| // This is similar to the RememberMe option when you log in. | ||
| app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie); | ||
|
|
||
| // Uncomment the following lines to enable logging in with third party login providers | ||
| //app.UseMicrosoftAccountAuthentication( | ||
| // clientId: "", | ||
| // clientSecret: ""); | ||
|
|
||
| //app.UseTwitterAuthentication( | ||
| // consumerKey: "", | ||
| // consumerSecret: ""); | ||
|
|
||
| //app.UseFacebookAuthentication( | ||
| // appId: "", | ||
| // appSecret: ""); | ||
|
|
||
| //app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions() | ||
| //{ | ||
| // ClientId = "", | ||
| // ClientSecret = "" | ||
| //}); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,24 @@ | ||
| body { | ||
| padding-top: 50px; | ||
| padding-bottom: 20px; | ||
| } | ||
|
|
||
| /* Set padding to keep content from hitting the edges */ | ||
| .body-content { | ||
| padding-left: 15px; | ||
| padding-right: 15px; | ||
| } | ||
|
|
||
| /* Override the default bootstrap behavior where horizontal description lists | ||
| will truncate terms that are too long to fit in the left column | ||
| */ | ||
| .dl-horizontal dt { | ||
| white-space: normal; | ||
| } | ||
|
|
||
| /* Set width on the form input elements since they're 100% wide by default */ | ||
| input, | ||
| select, | ||
| textarea { | ||
| max-width: 280px; | ||
| } |
| @@ -0,0 +1,30 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Web; | ||
| using System.Web.Mvc; | ||
|
|
||
| namespace WebApplication1.Controllers | ||
| { | ||
| public class HomeController : Controller | ||
| { | ||
| public ActionResult Index() | ||
| { | ||
| return View(); | ||
| } | ||
|
|
||
| public ActionResult About() | ||
| { | ||
| ViewBag.Message = "Your application description page."; | ||
|
|
||
| return View(); | ||
| } | ||
|
|
||
| public ActionResult Contact() | ||
| { | ||
| ViewBag.Message = "Your contact page."; | ||
|
|
||
| return View(); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,389 @@ | ||
| using System; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using System.Web; | ||
| using System.Web.Mvc; | ||
| using Microsoft.AspNet.Identity; | ||
| using Microsoft.AspNet.Identity.Owin; | ||
| using Microsoft.Owin.Security; | ||
| using WebApplication1.Models; | ||
|
|
||
| namespace WebApplication1.Controllers | ||
| { | ||
| [Authorize] | ||
| public class ManageController : Controller | ||
| { | ||
| private ApplicationSignInManager _signInManager; | ||
| private ApplicationUserManager _userManager; | ||
|
|
||
| public ManageController() | ||
| { | ||
| } | ||
|
|
||
| public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager) | ||
| { | ||
| UserManager = userManager; | ||
| SignInManager = signInManager; | ||
| } | ||
|
|
||
| public ApplicationSignInManager SignInManager | ||
| { | ||
| get | ||
| { | ||
| return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>(); | ||
| } | ||
| private set | ||
| { | ||
| _signInManager = value; | ||
| } | ||
| } | ||
|
|
||
| public ApplicationUserManager UserManager | ||
| { | ||
| get | ||
| { | ||
| return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); | ||
| } | ||
| private set | ||
| { | ||
| _userManager = value; | ||
| } | ||
| } | ||
|
|
||
| // | ||
| // GET: /Manage/Index | ||
| public async Task<ActionResult> Index(ManageMessageId? message) | ||
| { | ||
| ViewBag.StatusMessage = | ||
| message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed." | ||
| : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set." | ||
| : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set." | ||
| : message == ManageMessageId.Error ? "An error has occurred." | ||
| : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added." | ||
| : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed." | ||
| : ""; | ||
|
|
||
| var userId = User.Identity.GetUserId(); | ||
| var model = new IndexViewModel | ||
| { | ||
| HasPassword = HasPassword(), | ||
| PhoneNumber = await UserManager.GetPhoneNumberAsync(userId), | ||
| TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId), | ||
| Logins = await UserManager.GetLoginsAsync(userId), | ||
| BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId) | ||
| }; | ||
| return View(model); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/RemoveLogin | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public async Task<ActionResult> RemoveLogin(string loginProvider, string providerKey) | ||
| { | ||
| ManageMessageId? message; | ||
| var result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey)); | ||
| if (result.Succeeded) | ||
| { | ||
| var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); | ||
| } | ||
| message = ManageMessageId.RemoveLoginSuccess; | ||
| } | ||
| else | ||
| { | ||
| message = ManageMessageId.Error; | ||
| } | ||
| return RedirectToAction("ManageLogins", new { Message = message }); | ||
| } | ||
|
|
||
| // | ||
| // GET: /Manage/AddPhoneNumber | ||
| public ActionResult AddPhoneNumber() | ||
| { | ||
| return View(); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/AddPhoneNumber | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public async Task<ActionResult> AddPhoneNumber(AddPhoneNumberViewModel model) | ||
| { | ||
| if (!ModelState.IsValid) | ||
| { | ||
| return View(model); | ||
| } | ||
| // Generate the token and send it | ||
| var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number); | ||
| if (UserManager.SmsService != null) | ||
| { | ||
| var message = new IdentityMessage | ||
| { | ||
| Destination = model.Number, | ||
| Body = "Your security code is: " + code | ||
| }; | ||
| await UserManager.SmsService.SendAsync(message); | ||
| } | ||
| return RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number }); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/EnableTwoFactorAuthentication | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public async Task<ActionResult> EnableTwoFactorAuthentication() | ||
| { | ||
| await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), true); | ||
| var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); | ||
| } | ||
| return RedirectToAction("Index", "Manage"); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/DisableTwoFactorAuthentication | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public async Task<ActionResult> DisableTwoFactorAuthentication() | ||
| { | ||
| await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), false); | ||
| var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); | ||
| } | ||
| return RedirectToAction("Index", "Manage"); | ||
| } | ||
|
|
||
| // | ||
| // GET: /Manage/VerifyPhoneNumber | ||
| public async Task<ActionResult> VerifyPhoneNumber(string phoneNumber) | ||
| { | ||
| var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), phoneNumber); | ||
| // Send an SMS through the SMS provider to verify the phone number | ||
| return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber }); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/VerifyPhoneNumber | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public async Task<ActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model) | ||
| { | ||
| if (!ModelState.IsValid) | ||
| { | ||
| return View(model); | ||
| } | ||
| var result = await UserManager.ChangePhoneNumberAsync(User.Identity.GetUserId(), model.PhoneNumber, model.Code); | ||
| if (result.Succeeded) | ||
| { | ||
| var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); | ||
| } | ||
| return RedirectToAction("Index", new { Message = ManageMessageId.AddPhoneSuccess }); | ||
| } | ||
| // If we got this far, something failed, redisplay form | ||
| ModelState.AddModelError("", "Failed to verify phone"); | ||
| return View(model); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/RemovePhoneNumber | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public async Task<ActionResult> RemovePhoneNumber() | ||
| { | ||
| var result = await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), null); | ||
| if (!result.Succeeded) | ||
| { | ||
| return RedirectToAction("Index", new { Message = ManageMessageId.Error }); | ||
| } | ||
| var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); | ||
| } | ||
| return RedirectToAction("Index", new { Message = ManageMessageId.RemovePhoneSuccess }); | ||
| } | ||
|
|
||
| // | ||
| // GET: /Manage/ChangePassword | ||
| public ActionResult ChangePassword() | ||
| { | ||
| return View(); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/ChangePassword | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public async Task<ActionResult> ChangePassword(ChangePasswordViewModel model) | ||
| { | ||
| if (!ModelState.IsValid) | ||
| { | ||
| return View(model); | ||
| } | ||
| var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword); | ||
| if (result.Succeeded) | ||
| { | ||
| var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); | ||
| } | ||
| return RedirectToAction("Index", new { Message = ManageMessageId.ChangePasswordSuccess }); | ||
| } | ||
| AddErrors(result); | ||
| return View(model); | ||
| } | ||
|
|
||
| // | ||
| // GET: /Manage/SetPassword | ||
| public ActionResult SetPassword() | ||
| { | ||
| return View(); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/SetPassword | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public async Task<ActionResult> SetPassword(SetPasswordViewModel model) | ||
| { | ||
| if (ModelState.IsValid) | ||
| { | ||
| var result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword); | ||
| if (result.Succeeded) | ||
| { | ||
| var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); | ||
| } | ||
| return RedirectToAction("Index", new { Message = ManageMessageId.SetPasswordSuccess }); | ||
| } | ||
| AddErrors(result); | ||
| } | ||
|
|
||
| // If we got this far, something failed, redisplay form | ||
| return View(model); | ||
| } | ||
|
|
||
| // | ||
| // GET: /Manage/ManageLogins | ||
| public async Task<ActionResult> ManageLogins(ManageMessageId? message) | ||
| { | ||
| ViewBag.StatusMessage = | ||
| message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed." | ||
| : message == ManageMessageId.Error ? "An error has occurred." | ||
| : ""; | ||
| var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); | ||
| if (user == null) | ||
| { | ||
| return View("Error"); | ||
| } | ||
| var userLogins = await UserManager.GetLoginsAsync(User.Identity.GetUserId()); | ||
| var otherLogins = AuthenticationManager.GetExternalAuthenticationTypes().Where(auth => userLogins.All(ul => auth.AuthenticationType != ul.LoginProvider)).ToList(); | ||
| ViewBag.ShowRemoveButton = user.PasswordHash != null || userLogins.Count > 1; | ||
| return View(new ManageLoginsViewModel | ||
| { | ||
| CurrentLogins = userLogins, | ||
| OtherLogins = otherLogins | ||
| }); | ||
| } | ||
|
|
||
| // | ||
| // POST: /Manage/LinkLogin | ||
| [HttpPost] | ||
| [ValidateAntiForgeryToken] | ||
| public ActionResult LinkLogin(string provider) | ||
| { | ||
| // Request a redirect to the external login provider to link a login for the current user | ||
| return new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId()); | ||
| } | ||
|
|
||
| // | ||
| // GET: /Manage/LinkLoginCallback | ||
| public async Task<ActionResult> LinkLoginCallback() | ||
| { | ||
| var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId()); | ||
| if (loginInfo == null) | ||
| { | ||
| return RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error }); | ||
| } | ||
| var result = await UserManager.AddLoginAsync(User.Identity.GetUserId(), loginInfo.Login); | ||
| return result.Succeeded ? RedirectToAction("ManageLogins") : RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error }); | ||
| } | ||
|
|
||
| protected override void Dispose(bool disposing) | ||
| { | ||
| if (disposing && _userManager != null) | ||
| { | ||
| _userManager.Dispose(); | ||
| _userManager = null; | ||
| } | ||
|
|
||
| base.Dispose(disposing); | ||
| } | ||
|
|
||
| #region Helpers | ||
| // Used for XSRF protection when adding external logins | ||
| private const string XsrfKey = "XsrfId"; | ||
|
|
||
| private IAuthenticationManager AuthenticationManager | ||
| { | ||
| get | ||
| { | ||
| return HttpContext.GetOwinContext().Authentication; | ||
| } | ||
| } | ||
|
|
||
| private void AddErrors(IdentityResult result) | ||
| { | ||
| foreach (var error in result.Errors) | ||
| { | ||
| ModelState.AddModelError("", error); | ||
| } | ||
| } | ||
|
|
||
| private bool HasPassword() | ||
| { | ||
| var user = UserManager.FindById(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| return user.PasswordHash != null; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| private bool HasPhoneNumber() | ||
| { | ||
| var user = UserManager.FindById(User.Identity.GetUserId()); | ||
| if (user != null) | ||
| { | ||
| return user.PhoneNumber != null; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public enum ManageMessageId | ||
| { | ||
| AddPhoneSuccess, | ||
| ChangePasswordSuccess, | ||
| SetTwoFactorSuccess, | ||
| SetPasswordSuccess, | ||
| RemoveLoginSuccess, | ||
| RemovePhoneSuccess, | ||
| Error | ||
| } | ||
|
|
||
| #endregion | ||
| } | ||
| } |
| @@ -0,0 +1 @@ | ||
| <%@ Application Codebehind="Global.asax.cs" Inherits="WebApplication1.MvcApplication" Language="C#" %> |
| @@ -0,0 +1,21 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Web; | ||
| using System.Web.Mvc; | ||
| using System.Web.Optimization; | ||
| using System.Web.Routing; | ||
|
|
||
| namespace WebApplication1 | ||
| { | ||
| public class MvcApplication : System.Web.HttpApplication | ||
| { | ||
| protected void Application_Start() | ||
| { | ||
| AreaRegistration.RegisterAllAreas(); | ||
| FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); | ||
| RouteConfig.RegisterRoutes(RouteTable.Routes); | ||
| BundleConfig.RegisterBundles(BundleTable.Bundles); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,112 @@ | ||
| using System.Collections.Generic; | ||
| using System.ComponentModel.DataAnnotations; | ||
|
|
||
| namespace WebApplication1.Models | ||
| { | ||
| public class ExternalLoginConfirmationViewModel | ||
| { | ||
| [Required] | ||
| [Display(Name = "Email")] | ||
| public string Email { get; set; } | ||
| } | ||
|
|
||
| public class ExternalLoginListViewModel | ||
| { | ||
| public string ReturnUrl { get; set; } | ||
| } | ||
|
|
||
| public class SendCodeViewModel | ||
| { | ||
| public string SelectedProvider { get; set; } | ||
| public ICollection<System.Web.Mvc.SelectListItem> Providers { get; set; } | ||
| public string ReturnUrl { get; set; } | ||
| public bool RememberMe { get; set; } | ||
| } | ||
|
|
||
| public class VerifyCodeViewModel | ||
| { | ||
| [Required] | ||
| public string Provider { get; set; } | ||
|
|
||
| [Required] | ||
| [Display(Name = "Code")] | ||
| public string Code { get; set; } | ||
| public string ReturnUrl { get; set; } | ||
|
|
||
| [Display(Name = "Remember this browser?")] | ||
| public bool RememberBrowser { get; set; } | ||
|
|
||
| public bool RememberMe { get; set; } | ||
| } | ||
|
|
||
| public class ForgotViewModel | ||
| { | ||
| [Required] | ||
| [Display(Name = "Email")] | ||
| public string Email { get; set; } | ||
| } | ||
|
|
||
| public class LoginViewModel | ||
| { | ||
| [Required] | ||
| [Display(Name = "Email")] | ||
| [EmailAddress] | ||
| public string Email { get; set; } | ||
|
|
||
| [Required] | ||
| [DataType(DataType.Password)] | ||
| [Display(Name = "Password")] | ||
| public string Password { get; set; } | ||
|
|
||
| [Display(Name = "Remember me?")] | ||
| public bool RememberMe { get; set; } | ||
| } | ||
|
|
||
| public class RegisterViewModel | ||
| { | ||
| [Required] | ||
| [EmailAddress] | ||
| [Display(Name = "Email")] | ||
| public string Email { get; set; } | ||
|
|
||
| [Required] | ||
| [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] | ||
| [DataType(DataType.Password)] | ||
| [Display(Name = "Password")] | ||
| public string Password { get; set; } | ||
|
|
||
| [DataType(DataType.Password)] | ||
| [Display(Name = "Confirm password")] | ||
| [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] | ||
| public string ConfirmPassword { get; set; } | ||
| } | ||
|
|
||
| public class ResetPasswordViewModel | ||
| { | ||
| [Required] | ||
| [EmailAddress] | ||
| [Display(Name = "Email")] | ||
| public string Email { get; set; } | ||
|
|
||
| [Required] | ||
| [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] | ||
| [DataType(DataType.Password)] | ||
| [Display(Name = "Password")] | ||
| public string Password { get; set; } | ||
|
|
||
| [DataType(DataType.Password)] | ||
| [Display(Name = "Confirm password")] | ||
| [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] | ||
| public string ConfirmPassword { get; set; } | ||
|
|
||
| public string Code { get; set; } | ||
| } | ||
|
|
||
| public class ForgotPasswordViewModel | ||
| { | ||
| [Required] | ||
| [EmailAddress] | ||
| [Display(Name = "Email")] | ||
| public string Email { get; set; } | ||
| } | ||
| } |
| @@ -0,0 +1,33 @@ | ||
| using System.Data.Entity; | ||
| using System.Security.Claims; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.AspNet.Identity; | ||
| using Microsoft.AspNet.Identity.EntityFramework; | ||
|
|
||
| namespace WebApplication1.Models | ||
| { | ||
| // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. | ||
| public class ApplicationUser : IdentityUser | ||
| { | ||
| public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) | ||
| { | ||
| // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType | ||
| var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); | ||
| // Add custom user claims here | ||
| return userIdentity; | ||
| } | ||
| } | ||
|
|
||
| public class ApplicationDbContext : IdentityDbContext<ApplicationUser> | ||
| { | ||
| public ApplicationDbContext() | ||
| : base("DefaultConnection", throwIfV1Schema: false) | ||
| { | ||
| } | ||
|
|
||
| public static ApplicationDbContext Create() | ||
| { | ||
| return new ApplicationDbContext(); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,86 @@ | ||
| using System.Collections.Generic; | ||
| using System.ComponentModel.DataAnnotations; | ||
| using Microsoft.AspNet.Identity; | ||
| using Microsoft.Owin.Security; | ||
|
|
||
| namespace WebApplication1.Models | ||
| { | ||
| public class IndexViewModel | ||
| { | ||
| public bool HasPassword { get; set; } | ||
| public IList<UserLoginInfo> Logins { get; set; } | ||
| public string PhoneNumber { get; set; } | ||
| public bool TwoFactor { get; set; } | ||
| public bool BrowserRemembered { get; set; } | ||
| } | ||
|
|
||
| public class ManageLoginsViewModel | ||
| { | ||
| public IList<UserLoginInfo> CurrentLogins { get; set; } | ||
| public IList<AuthenticationDescription> OtherLogins { get; set; } | ||
| } | ||
|
|
||
| public class FactorViewModel | ||
| { | ||
| public string Purpose { get; set; } | ||
| } | ||
|
|
||
| public class SetPasswordViewModel | ||
| { | ||
| [Required] | ||
| [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] | ||
| [DataType(DataType.Password)] | ||
| [Display(Name = "New password")] | ||
| public string NewPassword { get; set; } | ||
|
|
||
| [DataType(DataType.Password)] | ||
| [Display(Name = "Confirm new password")] | ||
| [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] | ||
| public string ConfirmPassword { get; set; } | ||
| } | ||
|
|
||
| public class ChangePasswordViewModel | ||
| { | ||
| [Required] | ||
| [DataType(DataType.Password)] | ||
| [Display(Name = "Current password")] | ||
| public string OldPassword { get; set; } | ||
|
|
||
| [Required] | ||
| [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] | ||
| [DataType(DataType.Password)] | ||
| [Display(Name = "New password")] | ||
| public string NewPassword { get; set; } | ||
|
|
||
| [DataType(DataType.Password)] | ||
| [Display(Name = "Confirm new password")] | ||
| [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] | ||
| public string ConfirmPassword { get; set; } | ||
| } | ||
|
|
||
| public class AddPhoneNumberViewModel | ||
| { | ||
| [Required] | ||
| [Phone] | ||
| [Display(Name = "Phone Number")] | ||
| public string Number { get; set; } | ||
| } | ||
|
|
||
| public class VerifyPhoneNumberViewModel | ||
| { | ||
| [Required] | ||
| [Display(Name = "Code")] | ||
| public string Code { get; set; } | ||
|
|
||
| [Required] | ||
| [Phone] | ||
| [Display(Name = "Phone Number")] | ||
| public string PhoneNumber { get; set; } | ||
| } | ||
|
|
||
| public class ConfigureTwoFactorViewModel | ||
| { | ||
| public string SelectedProvider { get; set; } | ||
| public ICollection<System.Web.Mvc.SelectListItem> Providers { get; set; } | ||
| } | ||
| } |
| @@ -0,0 +1,151 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <title>Your ASP.NET application</title> | ||
| <style> | ||
| body { | ||
| background: #fff; | ||
| color: #505050; | ||
| font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif; | ||
| margin: 20px; | ||
| padding: 0; | ||
| } | ||
|
|
||
| #header { | ||
| background: #efefef; | ||
| padding: 0; | ||
| } | ||
|
|
||
| h1 { | ||
| font-size: 48px; | ||
| font-weight: normal; | ||
| margin: 0; | ||
| padding: 0 30px; | ||
| line-height: 150px; | ||
| } | ||
|
|
||
| p { | ||
| font-size: 20px; | ||
| color: #fff; | ||
| background: #969696; | ||
| padding: 0 30px; | ||
| line-height: 50px; | ||
| } | ||
|
|
||
| #main { | ||
| padding: 5px 30px; | ||
| } | ||
|
|
||
| .section { | ||
| width: 21.7%; | ||
| float: left; | ||
| margin: 0 0 0 4%; | ||
| } | ||
|
|
||
| .section h2 { | ||
| font-size: 13px; | ||
| text-transform: uppercase; | ||
| margin: 0; | ||
| border-bottom: 1px solid silver; | ||
| padding-bottom: 12px; | ||
| margin-bottom: 8px; | ||
| } | ||
|
|
||
| .section.first { | ||
| margin-left: 0; | ||
| } | ||
|
|
||
| .section.first h2 { | ||
| font-size: 24px; | ||
| text-transform: none; | ||
| margin-bottom: 25px; | ||
| border: none; | ||
| } | ||
|
|
||
| .section.first li { | ||
| border-top: 1px solid silver; | ||
| padding: 8px 0; | ||
| } | ||
|
|
||
| .section.last { | ||
| margin-right: 0; | ||
| } | ||
|
|
||
| ul { | ||
| list-style: none; | ||
| padding: 0; | ||
| margin: 0; | ||
| line-height: 20px; | ||
| } | ||
|
|
||
| li { | ||
| padding: 4px 0; | ||
| } | ||
|
|
||
| a { | ||
| color: #267cb2; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| a:hover { | ||
| text-decoration: underline; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
|
|
||
| <div id="header"> | ||
| <h1>Your ASP.NET application</h1> | ||
| <p>Congratulations! You've created a project</p> | ||
| </div> | ||
|
|
||
| <div id="main"> | ||
| <div class="section first"> | ||
| <h2>This application consists of:</h2> | ||
| <ul> | ||
| <li>Sample pages showing basic nav between Home, About, and Contact</li> | ||
| <li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=615519">Bootstrap</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615520">Authentication</a>, if selected, shows how to register and sign in</li> | ||
| <li>ASP.NET features managed using <a href="http://go.microsoft.com/fwlink/?LinkID=320756">NuGet</a></li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <div class="section"> | ||
| <h2>Customize app</h2> | ||
| <ul> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615541">Get started with ASP.NET MVC</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615523">Change the site's theme</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615524">Add more libraries using NuGet</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615542">Configure authentication</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615526">Customize information about the website users</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615527">Get information from social providers</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615528">Add HTTP services using ASP.NET Web API</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615529">Secure your web API</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615530">Add real-time web with ASP.NET SignalR</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615531">Add components using Scaffolding</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615532">Test your app with Browser Link</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615533">Share your project</a></li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <div class="section"> | ||
| <h2>Deploy</h2> | ||
| <ul> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615534">Ensure your app is ready for production</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615535">Microsoft Azure</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615536">Hosting providers</a></li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <div class="section last"> | ||
| <h2>Get help</h2> | ||
| <ul> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615537">Get help</a></li> | ||
| <li><a href="http://go.microsoft.com/fwlink/?LinkID=615538">Get more templates</a></li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
|
|
||
| </body> | ||
| </html> |
| @@ -0,0 +1,35 @@ | ||
| using System.Reflection; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| // General Information about an assembly is controlled through the following | ||
| // set of attributes. Change these attribute values to modify the information | ||
| // associated with an assembly. | ||
| [assembly: AssemblyTitle("WebApplication1")] | ||
| [assembly: AssemblyDescription("")] | ||
| [assembly: AssemblyConfiguration("")] | ||
| [assembly: AssemblyCompany("")] | ||
| [assembly: AssemblyProduct("WebApplication1")] | ||
| [assembly: AssemblyCopyright("Copyright © 2016")] | ||
| [assembly: AssemblyTrademark("")] | ||
| [assembly: AssemblyCulture("")] | ||
|
|
||
| // Setting ComVisible to false makes the types in this assembly not visible | ||
| // to COM components. If you need to access a type in this assembly from | ||
| // COM, set the ComVisible attribute to true on that type. | ||
| [assembly: ComVisible(false)] | ||
|
|
||
| // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
| [assembly: Guid("b36ab720-2be7-4f49-8a31-c01fafbb22ca")] | ||
|
|
||
| // Version information for an assembly consists of the following four values: | ||
| // | ||
| // Major Version | ||
| // Minor Version | ||
| // Build Number | ||
| // Revision | ||
| // | ||
| // You can specify all the values or you can default the Revision and Build Numbers | ||
| // by using the '*' as shown below: | ||
| [assembly: AssemblyVersion("1.0.0.0")] | ||
| [assembly: AssemblyFileVersion("1.0.0.0")] |
| @@ -0,0 +1,340 @@ | ||
| /* NUGET: BEGIN LICENSE TEXT | ||
| * | ||
| * Microsoft grants you the right to use these script files for the sole | ||
| * purpose of either: (i) interacting through your browser with the Microsoft | ||
| * website or online service, subject to the applicable licensing or use | ||
| * terms; or (ii) using the files as included with a Microsoft product subject | ||
| * to that product's license terms. Microsoft reserves all other rights to the | ||
| * files not expressly granted by Microsoft, whether by implication, estoppel | ||
| * or otherwise. Insofar as a script file is dual licensed under GPL, | ||
| * Microsoft neither took the code under GPL nor distributes it thereunder but | ||
| * under the terms set out in this paragraph. All notices and licenses | ||
| * below are for informational purposes only. | ||
| * | ||
| * NUGET: END LICENSE TEXT */ | ||
| /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ | ||
| /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ | ||
| window.matchMedia = window.matchMedia || (function(doc, undefined){ | ||
|
|
||
| var bool, | ||
| docElem = doc.documentElement, | ||
| refNode = docElem.firstElementChild || docElem.firstChild, | ||
| // fakeBody required for <FF4 when executed in <head> | ||
| fakeBody = doc.createElement('body'), | ||
| div = doc.createElement('div'); | ||
|
|
||
| div.id = 'mq-test-1'; | ||
| div.style.cssText = "position:absolute;top:-100em"; | ||
| fakeBody.style.background = "none"; | ||
| fakeBody.appendChild(div); | ||
|
|
||
| return function(q){ | ||
|
|
||
| div.innerHTML = '­<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>'; | ||
|
|
||
| docElem.insertBefore(fakeBody, refNode); | ||
| bool = div.offsetWidth == 42; | ||
| docElem.removeChild(fakeBody); | ||
|
|
||
| return { matches: bool, media: q }; | ||
| }; | ||
|
|
||
| })(document); | ||
|
|
||
|
|
||
|
|
||
|
|
||
| /*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ | ||
| (function( win ){ | ||
| //exposed namespace | ||
| win.respond = {}; | ||
|
|
||
| //define update even in native-mq-supporting browsers, to avoid errors | ||
| respond.update = function(){}; | ||
|
|
||
| //expose media query support flag for external use | ||
| respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; | ||
|
|
||
| //if media queries are supported, exit here | ||
| if( respond.mediaQueriesSupported ){ return; } | ||
|
|
||
| //define vars | ||
| var doc = win.document, | ||
| docElem = doc.documentElement, | ||
| mediastyles = [], | ||
| rules = [], | ||
| appendedEls = [], | ||
| parsedSheets = {}, | ||
| resizeThrottle = 30, | ||
| head = doc.getElementsByTagName( "head" )[0] || docElem, | ||
| base = doc.getElementsByTagName( "base" )[0], | ||
| links = head.getElementsByTagName( "link" ), | ||
| requestQueue = [], | ||
|
|
||
| //loop stylesheets, send text content to translate | ||
| ripCSS = function(){ | ||
| var sheets = links, | ||
| sl = sheets.length, | ||
| i = 0, | ||
| //vars for loop: | ||
| sheet, href, media, isCSS; | ||
|
|
||
| for( ; i < sl; i++ ){ | ||
| sheet = sheets[ i ], | ||
| href = sheet.href, | ||
| media = sheet.media, | ||
| isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; | ||
|
|
||
| //only links plz and prevent re-parsing | ||
| if( !!href && isCSS && !parsedSheets[ href ] ){ | ||
| // selectivizr exposes css through the rawCssText expando | ||
| if (sheet.styleSheet && sheet.styleSheet.rawCssText) { | ||
| translate( sheet.styleSheet.rawCssText, href, media ); | ||
| parsedSheets[ href ] = true; | ||
| } else { | ||
| if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) | ||
| || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ | ||
| requestQueue.push( { | ||
| href: href, | ||
| media: media | ||
| } ); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| makeRequests(); | ||
| }, | ||
|
|
||
| //recurse through request queue, get css text | ||
| makeRequests = function(){ | ||
| if( requestQueue.length ){ | ||
| var thisRequest = requestQueue.shift(); | ||
|
|
||
| ajax( thisRequest.href, function( styles ){ | ||
| translate( styles, thisRequest.href, thisRequest.media ); | ||
| parsedSheets[ thisRequest.href ] = true; | ||
| makeRequests(); | ||
| } ); | ||
| } | ||
| }, | ||
|
|
||
| //find media blocks in css text, convert to style blocks | ||
| translate = function( styles, href, media ){ | ||
| var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ), | ||
| ql = qs && qs.length || 0, | ||
| //try to get CSS path | ||
| href = href.substring( 0, href.lastIndexOf( "/" )), | ||
| repUrls = function( css ){ | ||
| return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" ); | ||
| }, | ||
| useMedia = !ql && media, | ||
| //vars used in loop | ||
| i = 0, | ||
| j, fullq, thisq, eachq, eql; | ||
|
|
||
| //if path exists, tack on trailing slash | ||
| if( href.length ){ href += "/"; } | ||
|
|
||
| //if no internal queries exist, but media attr does, use that | ||
| //note: this currently lacks support for situations where a media attr is specified on a link AND | ||
| //its associated stylesheet has internal CSS media queries. | ||
| //In those cases, the media attribute will currently be ignored. | ||
| if( useMedia ){ | ||
| ql = 1; | ||
| } | ||
|
|
||
|
|
||
| for( ; i < ql; i++ ){ | ||
| j = 0; | ||
|
|
||
| //media attr | ||
| if( useMedia ){ | ||
| fullq = media; | ||
| rules.push( repUrls( styles ) ); | ||
| } | ||
| //parse for styles | ||
| else{ | ||
| fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; | ||
| rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); | ||
| } | ||
|
|
||
| eachq = fullq.split( "," ); | ||
| eql = eachq.length; | ||
|
|
||
| for( ; j < eql; j++ ){ | ||
| thisq = eachq[ j ]; | ||
| mediastyles.push( { | ||
| media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all", | ||
| rules : rules.length - 1, | ||
| hasquery: thisq.indexOf("(") > -1, | ||
| minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), | ||
| maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) | ||
| } ); | ||
| } | ||
| } | ||
|
|
||
| applyMedia(); | ||
| }, | ||
|
|
||
| lastCall, | ||
|
|
||
| resizeDefer, | ||
|
|
||
| // returns the value of 1em in pixels | ||
| getEmValue = function() { | ||
| var ret, | ||
| div = doc.createElement('div'), | ||
| body = doc.body, | ||
| fakeUsed = false; | ||
|
|
||
| div.style.cssText = "position:absolute;font-size:1em;width:1em"; | ||
|
|
||
| if( !body ){ | ||
| body = fakeUsed = doc.createElement( "body" ); | ||
| body.style.background = "none"; | ||
| } | ||
|
|
||
| body.appendChild( div ); | ||
|
|
||
| docElem.insertBefore( body, docElem.firstChild ); | ||
|
|
||
| ret = div.offsetWidth; | ||
|
|
||
| if( fakeUsed ){ | ||
| docElem.removeChild( body ); | ||
| } | ||
| else { | ||
| body.removeChild( div ); | ||
| } | ||
|
|
||
| //also update eminpx before returning | ||
| ret = eminpx = parseFloat(ret); | ||
|
|
||
| return ret; | ||
| }, | ||
|
|
||
| //cached container for 1em value, populated the first time it's needed | ||
| eminpx, | ||
|
|
||
| //enable/disable styles | ||
| applyMedia = function( fromResize ){ | ||
| var name = "clientWidth", | ||
| docElemProp = docElem[ name ], | ||
| currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, | ||
| styleBlocks = {}, | ||
| lastLink = links[ links.length-1 ], | ||
| now = (new Date()).getTime(); | ||
|
|
||
| //throttle resize calls | ||
| if( fromResize && lastCall && now - lastCall < resizeThrottle ){ | ||
| clearTimeout( resizeDefer ); | ||
| resizeDefer = setTimeout( applyMedia, resizeThrottle ); | ||
| return; | ||
| } | ||
| else { | ||
| lastCall = now; | ||
| } | ||
|
|
||
| for( var i in mediastyles ){ | ||
| var thisstyle = mediastyles[ i ], | ||
| min = thisstyle.minw, | ||
| max = thisstyle.maxw, | ||
| minnull = min === null, | ||
| maxnull = max === null, | ||
| em = "em"; | ||
|
|
||
| if( !!min ){ | ||
| min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); | ||
| } | ||
| if( !!max ){ | ||
| max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); | ||
| } | ||
|
|
||
| // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true | ||
| if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ | ||
| if( !styleBlocks[ thisstyle.media ] ){ | ||
| styleBlocks[ thisstyle.media ] = []; | ||
| } | ||
| styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); | ||
| } | ||
| } | ||
|
|
||
| //remove any existing respond style element(s) | ||
| for( var i in appendedEls ){ | ||
| if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){ | ||
| head.removeChild( appendedEls[ i ] ); | ||
| } | ||
| } | ||
|
|
||
| //inject active styles, grouped by media type | ||
| for( var i in styleBlocks ){ | ||
| var ss = doc.createElement( "style" ), | ||
| css = styleBlocks[ i ].join( "\n" ); | ||
|
|
||
| ss.type = "text/css"; | ||
| ss.media = i; | ||
|
|
||
| //originally, ss was appended to a documentFragment and sheets were appended in bulk. | ||
| //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! | ||
| head.insertBefore( ss, lastLink.nextSibling ); | ||
|
|
||
| if ( ss.styleSheet ){ | ||
| ss.styleSheet.cssText = css; | ||
| } | ||
| else { | ||
| ss.appendChild( doc.createTextNode( css ) ); | ||
| } | ||
|
|
||
| //push to appendedEls to track for later removal | ||
| appendedEls.push( ss ); | ||
| } | ||
| }, | ||
| //tweaked Ajax functions from Quirksmode | ||
| ajax = function( url, callback ) { | ||
| var req = xmlHttp(); | ||
| if (!req){ | ||
| return; | ||
| } | ||
| req.open( "GET", url, true ); | ||
| req.onreadystatechange = function () { | ||
| if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){ | ||
| return; | ||
| } | ||
| callback( req.responseText ); | ||
| } | ||
| if ( req.readyState == 4 ){ | ||
| return; | ||
| } | ||
| req.send( null ); | ||
| }, | ||
| //define ajax obj | ||
| xmlHttp = (function() { | ||
| var xmlhttpmethod = false; | ||
| try { | ||
| xmlhttpmethod = new XMLHttpRequest(); | ||
| } | ||
| catch( e ){ | ||
| xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" ); | ||
| } | ||
| return function(){ | ||
| return xmlhttpmethod; | ||
| }; | ||
| })(); | ||
|
|
||
| //translate CSS | ||
| ripCSS(); | ||
|
|
||
| //expose update for re-running respond later on | ||
| respond.update = ripCSS; | ||
|
|
||
| //adjust on resize | ||
| function callMedia(){ | ||
| applyMedia( true ); | ||
| } | ||
| if( win.addEventListener ){ | ||
| win.addEventListener( "resize", callMedia, false ); | ||
| } | ||
| else if( win.attachEvent ){ | ||
| win.attachEvent( "onresize", callMedia ); | ||
| } | ||
| })(this); |
| @@ -0,0 +1,14 @@ | ||
| using Microsoft.Owin; | ||
| using Owin; | ||
|
|
||
| [assembly: OwinStartupAttribute(typeof(WebApplication1.Startup))] | ||
| namespace WebApplication1 | ||
| { | ||
| public partial class Startup | ||
| { | ||
| public void Configuration(IAppBuilder app) | ||
| { | ||
| ConfigureAuth(app); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,10 @@ | ||
| @{ | ||
| ViewBag.Title = "Confirm Email"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
| <div> | ||
| <p> | ||
| Thank you for confirming your email. Please @Html.ActionLink("Click here to Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) | ||
| </p> | ||
| </div> |
| @@ -0,0 +1,36 @@ | ||
| @model WebApplication1.Models.ExternalLoginConfirmationViewModel | ||
| @{ | ||
| ViewBag.Title = "Register"; | ||
| } | ||
| <h2>@ViewBag.Title.</h2> | ||
| <h3>Associate your @ViewBag.LoginProvider account.</h3> | ||
|
|
||
| @using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
|
|
||
| <h4>Association Form</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary(true, "", new { @class = "text-danger" }) | ||
| <p class="text-info"> | ||
| You've successfully authenticated with <strong>@ViewBag.LoginProvider</strong>. | ||
| Please enter a user name for this site below and click the Register button to finish | ||
| logging in. | ||
| </p> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) | ||
| @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" class="btn btn-default" value="Register" /> | ||
| </div> | ||
| </div> | ||
| } | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,8 @@ | ||
| @{ | ||
| ViewBag.Title = "Login Failure"; | ||
| } | ||
|
|
||
| <hgroup> | ||
| <h2>@ViewBag.Title.</h2> | ||
| <h3 class="text-danger">Unsuccessful login with service.</h3> | ||
| </hgroup> |
| @@ -0,0 +1,29 @@ | ||
| @model WebApplication1.Models.ForgotPasswordViewModel | ||
| @{ | ||
| ViewBag.Title = "Forgot your password?"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <h4>Enter your email.</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary("", new { @class = "text-danger" }) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" class="btn btn-default" value="Email Link" /> | ||
| </div> | ||
| </div> | ||
| } | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,13 @@ | ||
| @{ | ||
| ViewBag.Title = "Forgot Password Confirmation"; | ||
| } | ||
|
|
||
| <hgroup class="title"> | ||
| <h1>@ViewBag.Title.</h1> | ||
| </hgroup> | ||
| <div> | ||
| <p> | ||
| Please check your email to reset your password. | ||
| </p> | ||
| </div> | ||
|
|
| @@ -0,0 +1,63 @@ | ||
| @using WebApplication1.Models | ||
| @model LoginViewModel | ||
| @{ | ||
| ViewBag.Title = "Log in"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
| <div class="row"> | ||
| <div class="col-md-8"> | ||
| <section id="loginForm"> | ||
| @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <h4>Use a local account to log in.</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary(true, "", new { @class = "text-danger" }) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) | ||
| @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) | ||
| @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <div class="checkbox"> | ||
| @Html.CheckBoxFor(m => m.RememberMe) | ||
| @Html.LabelFor(m => m.RememberMe) | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" value="Log in" class="btn btn-default" /> | ||
| </div> | ||
| </div> | ||
| <p> | ||
| @Html.ActionLink("Register as a new user", "Register") | ||
| </p> | ||
| @* Enable this once you have account confirmation enabled for password reset functionality | ||
| <p> | ||
| @Html.ActionLink("Forgot your password?", "ForgotPassword") | ||
| </p>*@ | ||
| } | ||
| </section> | ||
| </div> | ||
| <div class="col-md-4"> | ||
| <section id="socialLoginForm"> | ||
| @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { ReturnUrl = ViewBag.ReturnUrl }) | ||
| </section> | ||
| </div> | ||
| </div> | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,41 @@ | ||
| @model WebApplication1.Models.RegisterViewModel | ||
| @{ | ||
| ViewBag.Title = "Register"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| @using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <h4>Create a new account.</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary("", new { @class = "text-danger" }) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" class="btn btn-default" value="Register" /> | ||
| </div> | ||
| </div> | ||
| } | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,42 @@ | ||
| @model WebApplication1.Models.ResetPasswordViewModel | ||
| @{ | ||
| ViewBag.Title = "Reset password"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| @using (Html.BeginForm("ResetPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <h4>Reset your password.</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary("", new { @class = "text-danger" }) | ||
| @Html.HiddenFor(model => model.Code) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.Password, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" class="btn btn-default" value="Reset" /> | ||
| </div> | ||
| </div> | ||
| } | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,12 @@ | ||
| @{ | ||
| ViewBag.Title = "Reset password confirmation"; | ||
| } | ||
|
|
||
| <hgroup class="title"> | ||
| <h1>@ViewBag.Title.</h1> | ||
| </hgroup> | ||
| <div> | ||
| <p> | ||
| Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) | ||
| </p> | ||
| </div> |
| @@ -0,0 +1,24 @@ | ||
| @model WebApplication1.Models.SendCodeViewModel | ||
| @{ | ||
| ViewBag.Title = "Send"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| @using (Html.BeginForm("SendCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { | ||
| @Html.AntiForgeryToken() | ||
| @Html.Hidden("rememberMe", @Model.RememberMe) | ||
| <h4>Send verification code</h4> | ||
| <hr /> | ||
| <div class="row"> | ||
| <div class="col-md-8"> | ||
| Select Two-Factor Authentication Provider: | ||
| @Html.DropDownListFor(model => model.SelectedProvider, Model.Providers) | ||
| <input type="submit" value="Submit" class="btn btn-default" /> | ||
| </div> | ||
| </div> | ||
| } | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,38 @@ | ||
| @model WebApplication1.Models.VerifyCodeViewModel | ||
| @{ | ||
| ViewBag.Title = "Verify"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| @using (Html.BeginForm("VerifyCode", "Account", new { ReturnUrl = Model.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { | ||
| @Html.AntiForgeryToken() | ||
| @Html.Hidden("provider", @Model.Provider) | ||
| @Html.Hidden("rememberMe", @Model.RememberMe) | ||
| <h4>Enter verification code</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary("", new { @class = "text-danger" }) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <div class="checkbox"> | ||
| @Html.CheckBoxFor(m => m.RememberBrowser) | ||
| @Html.LabelFor(m => m.RememberBrowser) | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" class="btn btn-default" value="Submit" /> | ||
| </div> | ||
| </div> | ||
| } | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,28 @@ | ||
| @model WebApplication1.Models.ExternalLoginListViewModel | ||
| @using Microsoft.Owin.Security | ||
|
|
||
| <h4>Use another service to log in.</h4> | ||
| <hr /> | ||
| @{ | ||
| var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); | ||
| if (loginProviders.Count() == 0) { | ||
| <div> | ||
| <p> | ||
| There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=403804">this article</a> | ||
| for details on setting up this ASP.NET application to support logging in via external services. | ||
| </p> | ||
| </div> | ||
| } | ||
| else { | ||
| using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl })) { | ||
| @Html.AntiForgeryToken() | ||
| <div id="socialLoginList"> | ||
| <p> | ||
| @foreach (AuthenticationDescription p in loginProviders) { | ||
| <button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">@p.AuthenticationType</button> | ||
| } | ||
| </p> | ||
| </div> | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,7 @@ | ||
| @{ | ||
| ViewBag.Title = "About"; | ||
| } | ||
| <h2>@ViewBag.Title.</h2> | ||
| <h3>@ViewBag.Message</h3> | ||
|
|
||
| <p>Use this area to provide additional information.</p> |
| @@ -0,0 +1,17 @@ | ||
| @{ | ||
| ViewBag.Title = "Contact"; | ||
| } | ||
| <h2>@ViewBag.Title.</h2> | ||
| <h3>@ViewBag.Message</h3> | ||
|
|
||
| <address> | ||
| One Microsoft Way<br /> | ||
| Redmond, WA 98052-6399<br /> | ||
| <abbr title="Phone">P:</abbr> | ||
| 425.555.0100 | ||
| </address> | ||
|
|
||
| <address> | ||
| <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> | ||
| <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> | ||
| </address> |
| @@ -0,0 +1,31 @@ | ||
| @{ | ||
| ViewBag.Title = "Home Page"; | ||
| } | ||
|
|
||
| <div class="jumbotron"> | ||
| <h1>ASP.NET</h1> | ||
| <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> | ||
| <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p> | ||
| </div> | ||
|
|
||
| <div class="row"> | ||
| <div class="col-md-4"> | ||
| <h2>Getting started</h2> | ||
| <p> | ||
| ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that | ||
| enables a clean separation of concerns and gives you full control over markup | ||
| for enjoyable, agile development. | ||
| </p> | ||
| <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p> | ||
| </div> | ||
| <div class="col-md-4"> | ||
| <h2>Get more libraries</h2> | ||
| <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p> | ||
| <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p> | ||
| </div> | ||
| <div class="col-md-4"> | ||
| <h2>Web Hosting</h2> | ||
| <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> | ||
| <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p> | ||
| </div> | ||
| </div> |
| @@ -0,0 +1,29 @@ | ||
| @model WebApplication1.Models.AddPhoneNumberViewModel | ||
| @{ | ||
| ViewBag.Title = "Phone Number"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| @using (Html.BeginForm("AddPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <h4>Add a phone number</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary("", new { @class = "text-danger" }) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Number, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.TextBoxFor(m => m.Number, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" class="btn btn-default" value="Submit" /> | ||
| </div> | ||
| </div> | ||
| } | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,40 @@ | ||
| @model WebApplication1.Models.ChangePasswordViewModel | ||
| @{ | ||
| ViewBag.Title = "Change Password"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| @using (Html.BeginForm("ChangePassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <h4>Change Password Form</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary("", new { @class = "text-danger" }) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" value="Change password" class="btn btn-default" /> | ||
| </div> | ||
| </div> | ||
| } | ||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,87 @@ | ||
| @model WebApplication1.Models.IndexViewModel | ||
| @{ | ||
| ViewBag.Title = "Manage"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| <p class="text-success">@ViewBag.StatusMessage</p> | ||
| <div> | ||
| <h4>Change your account settings</h4> | ||
| <hr /> | ||
| <dl class="dl-horizontal"> | ||
| <dt>Password:</dt> | ||
| <dd> | ||
| [ | ||
| @if (Model.HasPassword) | ||
| { | ||
| @Html.ActionLink("Change your password", "ChangePassword") | ||
| } | ||
| else | ||
| { | ||
| @Html.ActionLink("Create", "SetPassword") | ||
| } | ||
| ] | ||
| </dd> | ||
| <dt>External Logins:</dt> | ||
| <dd> | ||
| @Model.Logins.Count [ | ||
| @Html.ActionLink("Manage", "ManageLogins") ] | ||
| </dd> | ||
| @* | ||
| Phone Numbers can used as a second factor of verification in a two-factor authentication system. | ||
| See <a href="http://go.microsoft.com/fwlink/?LinkId=403804">this article</a> | ||
| for details on setting up this ASP.NET application to support two-factor authentication using SMS. | ||
| Uncomment the following block after you have set up two-factor authentication | ||
| *@ | ||
| @* | ||
| <dt>Phone Number:</dt> | ||
| <dd> | ||
| @(Model.PhoneNumber ?? "None") | ||
| @if (Model.PhoneNumber != null) | ||
| { | ||
| <br /> | ||
| <text>[ @Html.ActionLink("Change", "AddPhoneNumber") ]</text> | ||
| using (Html.BeginForm("RemovePhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <text>[<input type="submit" value="Remove" class="btn-link" />]</text> | ||
| } | ||
| } | ||
| else | ||
| { | ||
| <text>[ @Html.ActionLink("Add", "AddPhoneNumber") | ||
| } | ||
| </dd> | ||
| *@ | ||
| <dt>Two-Factor Authentication:</dt> | ||
| <dd> | ||
| <p> | ||
| There are no two-factor authentication providers configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=403804">this article</a> | ||
| for details on setting up this ASP.NET application to support two-factor authentication. | ||
| </p> | ||
| @*@if (Model.TwoFactor) | ||
| { | ||
| using (Html.BeginForm("DisableTwoFactorAuthentication", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <text>Enabled | ||
| <input type="submit" value="Disable" class="btn btn-link" /> | ||
| </text> | ||
| } | ||
| } | ||
| else | ||
| { | ||
| using (Html.BeginForm("EnableTwoFactorAuthentication", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <text>Disabled | ||
| <input type="submit" value="Enable" class="btn btn-link" /> | ||
| </text> | ||
| } | ||
| }*@ | ||
| </dd> | ||
| </dl> | ||
| </div> |
| @@ -0,0 +1,70 @@ | ||
| @model WebApplication1.Models.ManageLoginsViewModel | ||
| @using Microsoft.Owin.Security | ||
| @{ | ||
| ViewBag.Title = "Manage your external logins"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| <p class="text-success">@ViewBag.StatusMessage</p> | ||
| @{ | ||
| var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); | ||
| if (loginProviders.Count() == 0) { | ||
| <div> | ||
| <p> | ||
| There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=313242">this article</a> | ||
| for details on setting up this ASP.NET application to support logging in via external services. | ||
| </p> | ||
| </div> | ||
| } | ||
| else | ||
| { | ||
| if (Model.CurrentLogins.Count > 0) | ||
| { | ||
| <h4>Registered Logins</h4> | ||
| <table class="table"> | ||
| <tbody> | ||
| @foreach (var account in Model.CurrentLogins) | ||
| { | ||
| <tr> | ||
| <td>@account.LoginProvider</td> | ||
| <td> | ||
| @if (ViewBag.ShowRemoveButton) | ||
| { | ||
| using (Html.BeginForm("RemoveLogin", "Manage")) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <div> | ||
| @Html.Hidden("loginProvider", account.LoginProvider) | ||
| @Html.Hidden("providerKey", account.ProviderKey) | ||
| <input type="submit" class="btn btn-default" value="Remove" title="Remove this @account.LoginProvider login from your account" /> | ||
| </div> | ||
| } | ||
| } | ||
| else | ||
| { | ||
| @: | ||
| } | ||
| </td> | ||
| </tr> | ||
| } | ||
| </tbody> | ||
| </table> | ||
| } | ||
| if (Model.OtherLogins.Count > 0) | ||
| { | ||
| using (Html.BeginForm("LinkLogin", "Manage")) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| <div id="socialLoginList"> | ||
| <p> | ||
| @foreach (AuthenticationDescription p in Model.OtherLogins) | ||
| { | ||
| <button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">@p.AuthenticationType</button> | ||
| } | ||
| </p> | ||
| </div> | ||
| } | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,39 @@ | ||
| @model WebApplication1.Models.SetPasswordViewModel | ||
| @{ | ||
| ViewBag.Title = "Create Password"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
| <p class="text-info"> | ||
| You do not have a local username/password for this site. Add a local | ||
| account so you can log in without an external login. | ||
| </p> | ||
|
|
||
| @using (Html.BeginForm("SetPassword", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
|
|
||
| <h4>Create Local Login</h4> | ||
| <hr /> | ||
| @Html.ValidationSummary("", new { @class = "text-danger" }) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" value="Set password" class="btn btn-default" /> | ||
| </div> | ||
| </div> | ||
| } | ||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,31 @@ | ||
| @model WebApplication1.Models.VerifyPhoneNumberViewModel | ||
| @{ | ||
| ViewBag.Title = "Verify Phone Number"; | ||
| } | ||
|
|
||
| <h2>@ViewBag.Title.</h2> | ||
|
|
||
| @using (Html.BeginForm("VerifyPhoneNumber", "Manage", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
| @Html.Hidden("phoneNumber", @Model.PhoneNumber) | ||
| <h4>Enter verification code</h4> | ||
| <h5>@ViewBag.Status</h5> | ||
| <hr /> | ||
| @Html.ValidationSummary("", new { @class = "text-danger" }) | ||
| <div class="form-group"> | ||
| @Html.LabelFor(m => m.Code, new { @class = "col-md-2 control-label" }) | ||
| <div class="col-md-10"> | ||
| @Html.TextBoxFor(m => m.Code, new { @class = "form-control" }) | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <div class="col-md-offset-2 col-md-10"> | ||
| <input type="submit" class="btn btn-default" value="Submit" /> | ||
| </div> | ||
| </div> | ||
| } | ||
|
|
||
| @section Scripts { | ||
| @Scripts.Render("~/bundles/jqueryval") | ||
| } |
| @@ -0,0 +1,9 @@ | ||
| @model System.Web.Mvc.HandleErrorInfo | ||
|
|
||
| @{ | ||
| ViewBag.Title = "Error"; | ||
| } | ||
|
|
||
| <h1 class="text-danger">Error.</h1> | ||
| <h2 class="text-danger">An error occurred while processing your request.</h2> | ||
|
|
| @@ -0,0 +1,10 @@ | ||
| @model System.Web.Mvc.HandleErrorInfo | ||
|
|
||
| @{ | ||
| ViewBag.Title = "Locked Out"; | ||
| } | ||
|
|
||
| <hgroup> | ||
| <h1 class="text-danger">Locked out.</h1> | ||
| <h2 class="text-danger">This account has been locked out, please try again later.</h2> | ||
| </hgroup> |
| @@ -0,0 +1,44 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>@ViewBag.Title - My ASP.NET Application</title> | ||
| @Styles.Render("~/Content/css") | ||
| @Scripts.Render("~/bundles/modernizr") | ||
|
|
||
| </head> | ||
| <body> | ||
| <div class="navbar navbar-inverse navbar-fixed-top"> | ||
| <div class="container"> | ||
| <div class="navbar-header"> | ||
| <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> | ||
| <span class="icon-bar"></span> | ||
| <span class="icon-bar"></span> | ||
| <span class="icon-bar"></span> | ||
| </button> | ||
| @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) | ||
| </div> | ||
| <div class="navbar-collapse collapse"> | ||
| <ul class="nav navbar-nav"> | ||
| <li>@Html.ActionLink("Home", "Index", "Home")</li> | ||
| <li>@Html.ActionLink("About", "About", "Home")</li> | ||
| <li>@Html.ActionLink("Contact", "Contact", "Home")</li> | ||
| </ul> | ||
| @Html.Partial("_LoginPartial") | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="container body-content"> | ||
| @RenderBody() | ||
| <hr /> | ||
| <footer> | ||
| <p>© @DateTime.Now.Year - My ASP.NET Application</p> | ||
| </footer> | ||
| </div> | ||
|
|
||
| @Scripts.Render("~/bundles/jquery") | ||
| @Scripts.Render("~/bundles/bootstrap") | ||
| @RenderSection("scripts", required: false) | ||
| </body> | ||
| </html> |
| @@ -0,0 +1,22 @@ | ||
| @using Microsoft.AspNet.Identity | ||
| @if (Request.IsAuthenticated) | ||
| { | ||
| using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) | ||
| { | ||
| @Html.AntiForgeryToken() | ||
|
|
||
| <ul class="nav navbar-nav navbar-right"> | ||
| <li> | ||
| @Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" }) | ||
| </li> | ||
| <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li> | ||
| </ul> | ||
| } | ||
| } | ||
| else | ||
| { | ||
| <ul class="nav navbar-nav navbar-right"> | ||
| <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li> | ||
| <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li> | ||
| </ul> | ||
| } |
| @@ -0,0 +1,43 @@ | ||
| <?xml version="1.0"?> | ||
|
|
||
| <configuration> | ||
| <configSections> | ||
| <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> | ||
| <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | ||
| <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | ||
| </sectionGroup> | ||
| </configSections> | ||
|
|
||
| <system.web.webPages.razor> | ||
| <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> | ||
| <pages pageBaseType="System.Web.Mvc.WebViewPage"> | ||
| <namespaces> | ||
| <add namespace="System.Web.Mvc" /> | ||
| <add namespace="System.Web.Mvc.Ajax" /> | ||
| <add namespace="System.Web.Mvc.Html" /> | ||
| <add namespace="System.Web.Optimization"/> | ||
| <add namespace="System.Web.Routing" /> | ||
| <add namespace="WebApplication1" /> | ||
| </namespaces> | ||
| </pages> | ||
| </system.web.webPages.razor> | ||
|
|
||
| <appSettings> | ||
| <add key="webpages:Enabled" value="false" /> | ||
| </appSettings> | ||
|
|
||
| <system.webServer> | ||
| <handlers> | ||
| <remove name="BlockViewHandler"/> | ||
| <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /> | ||
| </handlers> | ||
| </system.webServer> | ||
|
|
||
| <system.web> | ||
| <compilation> | ||
| <assemblies> | ||
| <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> | ||
| </assemblies> | ||
| </compilation> | ||
| </system.web> | ||
| </configuration> |
| @@ -0,0 +1,3 @@ | ||
| @{ | ||
| Layout = "~/Views/Shared/_Layout.cshtml"; | ||
| } |
| @@ -0,0 +1,30 @@ | ||
| <?xml version="1.0"?> | ||
|
|
||
| <!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 --> | ||
|
|
||
| <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | ||
| <!-- | ||
| In the example below, the "SetAttributes" transform will change the value of | ||
| "connectionString" to use "ReleaseSQLServer" only when the "Match" locator | ||
| finds an attribute "name" that has a value of "MyDB". | ||
| <connectionStrings> | ||
| <add name="MyDB" | ||
| connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" | ||
| xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> | ||
| </connectionStrings> | ||
| --> | ||
| <system.web> | ||
| <!-- | ||
| In the example below, the "Replace" transform will replace the entire | ||
| <customErrors> section of your Web.config file. | ||
| Note that because there is only one customErrors section under the | ||
| <system.web> node, there is no need to use the "xdt:Locator" attribute. | ||
| <customErrors defaultRedirect="GenericError.htm" | ||
| mode="RemoteOnly" xdt:Transform="Replace"> | ||
| <error statusCode="500" redirect="InternalError.htm"/> | ||
| </customErrors> | ||
| --> | ||
| </system.web> | ||
| </configuration> |
| @@ -0,0 +1,31 @@ | ||
| <?xml version="1.0"?> | ||
|
|
||
| <!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 --> | ||
|
|
||
| <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | ||
| <!-- | ||
| In the example below, the "SetAttributes" transform will change the value of | ||
| "connectionString" to use "ReleaseSQLServer" only when the "Match" locator | ||
| finds an attribute "name" that has a value of "MyDB". | ||
| <connectionStrings> | ||
| <add name="MyDB" | ||
| connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" | ||
| xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> | ||
| </connectionStrings> | ||
| --> | ||
| <system.web> | ||
| <compilation xdt:Transform="RemoveAttributes(debug)" /> | ||
| <!-- | ||
| In the example below, the "Replace" transform will replace the entire | ||
| <customErrors> section of your Web.config file. | ||
| Note that because there is only one customErrors section under the | ||
| <system.web> node, there is no need to use the "xdt:Locator" attribute. | ||
| <customErrors defaultRedirect="GenericError.htm" | ||
| mode="RemoteOnly" xdt:Transform="Replace"> | ||
| <error statusCode="500" redirect="InternalError.htm"/> | ||
| </customErrors> | ||
| --> | ||
| </system.web> | ||
| </configuration> |
| @@ -0,0 +1,96 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- | ||
| For more information on how to configure your ASP.NET application, please visit | ||
| http://go.microsoft.com/fwlink/?LinkId=301880 | ||
| --> | ||
| <configuration> | ||
| <configSections> | ||
| <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> | ||
| <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
| </configSections> | ||
| <connectionStrings> | ||
| <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20161118081247.mdf;Initial Catalog=aspnet-WebApplication1-20161118081247;Integrated Security=True" providerName="System.Data.SqlClient" /> | ||
| </connectionStrings> | ||
| <appSettings> | ||
| <add key="webpages:Version" value="3.0.0.0" /> | ||
| <add key="webpages:Enabled" value="false" /> | ||
| <add key="ClientValidationEnabled" value="true" /> | ||
| <add key="UnobtrusiveJavaScriptEnabled" value="true" /> | ||
| </appSettings> | ||
| <system.web> | ||
| <authentication mode="None" /> | ||
| <compilation debug="true" targetFramework="4.6.1" /> | ||
| <httpRuntime targetFramework="4.6.1" /> | ||
| <httpModules> | ||
| <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> | ||
| </httpModules> | ||
| </system.web> | ||
| <system.webServer> | ||
| <modules> | ||
| <remove name="FormsAuthentication" /> | ||
| <remove name="ApplicationInsightsWebTracking" /> | ||
| <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> | ||
| </modules> | ||
| <validation validateIntegratedModeConfiguration="false" /> | ||
| </system.webServer> | ||
| <runtime> | ||
| <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> | ||
| <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> | ||
| <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> | ||
| </dependentAssembly> | ||
| </assemblyBinding> | ||
| </runtime> | ||
| <entityFramework> | ||
| <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> | ||
| <parameters> | ||
| <parameter value="mssqllocaldb" /> | ||
| </parameters> | ||
| </defaultConnectionFactory> | ||
| <providers> | ||
| <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> | ||
| </providers> | ||
| </entityFramework> | ||
| <system.codedom> | ||
| <compilers> | ||
| <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> | ||
| <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /> | ||
| </compilers> | ||
| </system.codedom> | ||
| </configuration> |