Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IUserRepository users,
                              IAuthenticationRegisterService registration, IHashable hashManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseStaticFiles();
            app.UseDefaultFiles();
            app.UseAuthentication();
            app.UseFileServer();


            app.UseSignalR(route => route.MapHub <NotificationHub>("/notification"));

            var supportedCulture = new[]
            {
                new CultureInfo("en"),
                new CultureInfo("ru")
            };

            app.UseRequestLocalization(new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("en"),
                SupportedCultures     = supportedCulture,
                SupportedUICultures   = supportedCulture
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            if (users.GetByName("Admin") == null)
            {
                registration.CreateNewUser("Admin", "*****@*****.**", "Admin", hashManager, "Admin");
            }
        }
Example #2
0
 public AccountController(IUserRepository users, IHashable hashManager, IAuthenticationRegisterService usersManager)
 {
     this.users        = users;
     this.hashManager  = hashManager;
     this.usersManager = usersManager;
 }