Skip to content

Commit 909baad

Browse files
committed
File Added
1 parent 8442acc commit 909baad

File tree

1,842 files changed

+453160
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,842 files changed

+453160
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System.Web;
2+
using System.Web.Optimization;
3+
4+
namespace MyFollowAppWeb
5+
{
6+
public class BundleConfig
7+
{
8+
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
9+
public static void RegisterBundles(BundleCollection bundles)
10+
{
11+
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12+
"~/Scripts/jquery-{version}.js"));
13+
14+
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
15+
"~/Scripts/jquery.validate*"));
16+
17+
// Use the development version of Modernizr to develop with and learn from. Then, when you're
18+
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
19+
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
20+
"~/Scripts/modernizr-*"));
21+
22+
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
23+
"~/Scripts/bootstrap.js",
24+
"~/Scripts/respond.js"));
25+
26+
bundles.Add(new StyleBundle("~/Content/css").Include(
27+
"~/Content/bootstrap.css",
28+
"~/Content/site.css"));
29+
bundles.Add(new ScriptBundle("~/bundles/angularjs").Include(
30+
"~/Scripts/angular.js",
31+
"~/Scripts/angular.min.js",
32+
"~/Scripts/angular-animate.js",
33+
"~/Scripts/angular-animate.min.js",
34+
"~/Scripts/angular-route.js"));
35+
36+
bundles.Add(new ScriptBundle("~/bundles/MyFollowjs").Include(
37+
"~/Scripts/MyFollowApp/MyFollow.js"));
38+
}
39+
}
40+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Web;
2+
using System.Web.Mvc;
3+
4+
namespace MyFollowAppWeb
5+
{
6+
public class FilterConfig
7+
{
8+
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
9+
{
10+
filters.Add(new HandleErrorAttribute());
11+
}
12+
}
13+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data.Entity;
4+
using System.Linq;
5+
using System.Security.Claims;
6+
using System.Threading.Tasks;
7+
using System.Web;
8+
using Microsoft.AspNet.Identity;
9+
using Microsoft.AspNet.Identity.EntityFramework;
10+
using Microsoft.AspNet.Identity.Owin;
11+
using Microsoft.Owin;
12+
using Microsoft.Owin.Security;
13+
using MyFollowAppWeb.Models;
14+
15+
namespace MyFollowAppWeb
16+
{
17+
public class EmailService : IIdentityMessageService
18+
{
19+
public Task SendAsync(IdentityMessage message)
20+
{
21+
// Plug in your email service here to send an email.
22+
return Task.FromResult(0);
23+
}
24+
}
25+
26+
public class SmsService : IIdentityMessageService
27+
{
28+
public Task SendAsync(IdentityMessage message)
29+
{
30+
// Plug in your SMS service here to send a text message.
31+
return Task.FromResult(0);
32+
}
33+
}
34+
35+
// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
36+
public class ApplicationUserManager : UserManager<ApplicationUser>
37+
{
38+
public ApplicationUserManager(IUserStore<ApplicationUser> store)
39+
: base(store)
40+
{
41+
}
42+
43+
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
44+
{
45+
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
46+
// Configure validation logic for usernames
47+
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
48+
{
49+
AllowOnlyAlphanumericUserNames = false,
50+
RequireUniqueEmail = true
51+
};
52+
53+
// Configure validation logic for passwords
54+
manager.PasswordValidator = new PasswordValidator
55+
{
56+
RequiredLength = 6,
57+
RequireNonLetterOrDigit = true,
58+
RequireDigit = true,
59+
RequireLowercase = true,
60+
RequireUppercase = true,
61+
};
62+
63+
// Configure user lockout defaults
64+
manager.UserLockoutEnabledByDefault = true;
65+
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
66+
manager.MaxFailedAccessAttemptsBeforeLockout = 5;
67+
68+
// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
69+
// You can write your own provider and plug it in here.
70+
manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ApplicationUser>
71+
{
72+
MessageFormat = "Your security code is {0}"
73+
});
74+
manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ApplicationUser>
75+
{
76+
Subject = "Security Code",
77+
BodyFormat = "Your security code is {0}"
78+
});
79+
manager.EmailService = new EmailService();
80+
manager.SmsService = new SmsService();
81+
var dataProtectionProvider = options.DataProtectionProvider;
82+
if (dataProtectionProvider != null)
83+
{
84+
manager.UserTokenProvider =
85+
new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
86+
}
87+
return manager;
88+
}
89+
}
90+
91+
// Configure the application sign-in manager which is used in this application.
92+
public class ApplicationSignInManager : SignInManager<ApplicationUser, string>
93+
{
94+
public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
95+
: base(userManager, authenticationManager)
96+
{
97+
}
98+
99+
public override Task<ClaimsIdentity> CreateUserIdentityAsync(ApplicationUser user)
100+
{
101+
return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
102+
}
103+
104+
public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
105+
{
106+
return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
107+
}
108+
}
109+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using System.Web.Routing;
7+
8+
namespace MyFollowAppWeb
9+
{
10+
public class RouteConfig
11+
{
12+
public static void RegisterRoutes(RouteCollection routes)
13+
{
14+
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15+
16+
routes.MapRoute(
17+
name: "Default",
18+
url: "{controller}/{action}/{id}",
19+
defaults: new { controller = "ProductOwnerRequest", action = "Create", id = UrlParameter.Optional }
20+
);
21+
}
22+
}
23+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System;
2+
using Microsoft.AspNet.Identity;
3+
using Microsoft.AspNet.Identity.Owin;
4+
using Microsoft.Owin;
5+
using Microsoft.Owin.Security.Cookies;
6+
using Microsoft.Owin.Security.Google;
7+
using Owin;
8+
using MyFollowAppWeb.Models;
9+
10+
namespace MyFollowAppWeb
11+
{
12+
public partial class Startup
13+
{
14+
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
15+
public void ConfigureAuth(IAppBuilder app)
16+
{
17+
// Configure the db context, user manager and signin manager to use a single instance per request
18+
app.CreatePerOwinContext(ApplicationDbContext.Create);
19+
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
20+
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
21+
22+
// Enable the application to use a cookie to store information for the signed in user
23+
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
24+
// Configure the sign in cookie
25+
app.UseCookieAuthentication(new CookieAuthenticationOptions
26+
{
27+
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
28+
LoginPath = new PathString("/Account/Login"),
29+
Provider = new CookieAuthenticationProvider
30+
{
31+
// Enables the application to validate the security stamp when the user logs in.
32+
// This is a security feature which is used when you change a password or add an external login to your account.
33+
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
34+
validateInterval: TimeSpan.FromMinutes(30),
35+
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
36+
}
37+
});
38+
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
39+
40+
// Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
41+
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
42+
43+
// Enables the application to remember the second login verification factor such as phone or email.
44+
// 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.
45+
// This is similar to the RememberMe option when you log in.
46+
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
47+
48+
// Uncomment the following lines to enable logging in with third party login providers
49+
//app.UseMicrosoftAccountAuthentication(
50+
// clientId: "",
51+
// clientSecret: "");
52+
53+
//app.UseTwitterAuthentication(
54+
// consumerKey: "",
55+
// consumerSecret: "");
56+
57+
58+
59+
//app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
60+
//{
61+
// ClientId = "",
62+
// ClientSecret = ""
63+
//});
64+
}
65+
}
66+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
3+
<TelemetryModules>
4+
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>
5+
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
6+
<!--
7+
Use the following syntax here to collect additional performance counters:
8+
9+
<Counters>
10+
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
11+
...
12+
</Counters>
13+
14+
PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName
15+
16+
Counter names may only contain letters, round brackets, forward slashes, hyphens, underscores, spaces and dots.
17+
You may provide an optional ReportAs attribute which will be used as the metric name when reporting counter data.
18+
For the purposes of reporting, metric names will be sanitized by removing all invalid characters from the resulting metric name.
19+
20+
NOTE: performance counters configuration will be lost upon NuGet upgrade.
21+
22+
The following placeholders are supported as InstanceName:
23+
??APP_WIN32_PROC?? - instance name of the application process for Win32 counters.
24+
??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
25+
??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
26+
-->
27+
</Add>
28+
<Add Type="Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights"/>
29+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
30+
<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web"/>
31+
<Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web"/>
32+
</TelemetryModules>
33+
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
34+
<!--
35+
Learn more about Application Insights configuration with ApplicationInsights.config here:
36+
http://go.microsoft.com/fwlink/?LinkID=513840
37+
38+
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
39+
-->
40+
<TelemetryInitializers>
41+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
42+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DomainNameRoleInstanceTelemetryInitializer, Microsoft.AI.WindowsServer"/>
43+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
44+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeviceTelemetryInitializer, Microsoft.AI.WindowsServer"/>
45+
<Add Type="Microsoft.ApplicationInsights.Web.SyntheticTelemetryInitializer, Microsoft.AI.Web"/>
46+
<Add Type="Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer, Microsoft.AI.Web"/>
47+
<Add Type="Microsoft.ApplicationInsights.Web.UserAgentTelemetryInitializer, Microsoft.AI.Web"/>
48+
<Add Type="Microsoft.ApplicationInsights.Web.OperationNameTelemetryInitializer, Microsoft.AI.Web"/>
49+
<Add Type="Microsoft.ApplicationInsights.Web.OperationIdTelemetryInitializer, Microsoft.AI.Web"/>
50+
<Add Type="Microsoft.ApplicationInsights.Web.UserTelemetryInitializer, Microsoft.AI.Web"/>
51+
<Add Type="Microsoft.ApplicationInsights.Web.SessionTelemetryInitializer, Microsoft.AI.Web"/>
52+
</TelemetryInitializers>
53+
<!--
54+
Learn more about Application Insights configuration with ApplicationInsights.config here:
55+
http://go.microsoft.com/fwlink/?LinkID=513840
56+
57+
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
58+
--></ApplicationInsights>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
body {
2+
padding-top: 50px;
3+
padding-bottom: 20px;
4+
}
5+
6+
/* Set padding to keep content from hitting the edges */
7+
.body-content {
8+
padding-left: 15px;
9+
padding-right: 15px;
10+
}
11+
12+
/* Override the default bootstrap behavior where horizontal description lists
13+
will truncate terms that are too long to fit in the left column
14+
*/
15+
.dl-horizontal dt {
16+
white-space: normal;
17+
}
18+
19+
/* Set width on the form input elements since they're 100% wide by default */
20+
input,
21+
select,
22+
textarea {
23+
max-width: 280px;
24+
}

0 commit comments

Comments
 (0)