Exemplo n.º 1
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.GetAppConfig().AllowGuests,
         AllowPasswordAuth = _cfgProvider.GetStaticConfig().Auth.AllowPasswordAuth,
         Providers         = _provs.AvailableProviders,
         IsFirstUser       = await _auth.IsFirstUserAsync(),
         Status            = status
     };
     return(View(new LocalLoginVM()));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Checks the authorization if the config requires it.
        /// </summary>
        protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, AuthRequirement requirement)
        {
            var cfg = _cfgProvider.GetAppConfig();

            if (cfg.AllowGuests)
            {
                context.Succeed(requirement);
                return;
            }

            var user = await _userMgr.GetUserAsync(context.User);

            if (user?.IsValidated == true)
            {
                context.Succeed(requirement);
            }
        }
Exemplo n.º 3
0
 protected override Task <AppConfigViewModel> DetailsAsync(string id)
 {
     return(configService.GetAppConfig(id));
 }