Esempio n. 1
0
        public async Task <ActionResult> Index([FromQuery] UsersListRequestVM vm)
        {
            var users = await _users.GetUsersAsync(vm);

            ViewBag.AllowPasswordAuth = _config.GetStaticConfig().Auth.AllowPasswordAuth;
            return(View(users));
        }
Esempio n. 2
0
 public UsersManagerService(AppDbContext db, UserManager <AppUser> userMgr, IMapper mapper, BonsaiConfigService config)
 {
     _db      = db;
     _userMgr = userMgr;
     _mapper  = mapper;
     _demoCfg = config.GetStaticConfig().DemoMode;
 }
Esempio n. 3
0
 /// <summary>
 /// Displays the login page.
 /// </summary>
 private async Task <ActionResult> ViewLoginFormAsync(LoginStatus?status, string returnUrl = null)
 {
     ViewBag.Data = new LoginDataVM
     {
         ReturnUrl         = returnUrl,
         AllowGuests       = _cfgProvider.GetDynamicConfig().AllowGuests,
         AllowPasswordAuth = _cfgProvider.GetStaticConfig().Auth.AllowPasswordAuth,
         Providers         = _provs.AvailableProviders,
         IsFirstUser       = await _auth.IsFirstUserAsync(),
         Status            = status
     };
     return(View(new LocalLoginVM()));
 }
Esempio n. 4
0
        public void OnAuthorization(AuthorizationFilterContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var effectivePolicy = context.FindEffectivePolicy <IRequestSizePolicy>();

            if (effectivePolicy != null && effectivePolicy != this)
            {
                return;
            }

            var maxRequestBodySizeFeature = context.HttpContext.Features.Get <IHttpMaxRequestBodySizeFeature>();

            if (maxRequestBodySizeFeature?.IsReadOnly != false)
            {
                return;
            }

            maxRequestBodySizeFeature.MaxRequestBodySize = _cfg.GetStaticConfig().WebServer.MaxUploadSize;
        }