Пример #1
0
        public async Task <IActionResult> Logout()
        {
            //var demo = User.FindFirstValue("RoleId");
            ////var listRole = RoleMgr.Roles.ToListAsync();
            //var demo1 = User.Claims.ToList();
            //HttpContext.Session.Clear();
            await SignInMgr.SignOutAsync();

            return(RedirectToAction("Index", "Login"));
        }
Пример #2
0
        public async Task <IActionResult> DeleteAccount()
        {
            // get current user
            var       username = User.Identity.Name.ToUpper();
            UserModel user     = UserMgr.Users.Where(x => x.NormalizedUserName == username).FirstOrDefault();

            // sign current user out and delete account
            await SignInMgr.SignOutAsync();

            await UserMgr.DeleteAsync(user);

            return(Redirect("/"));
        }
Пример #3
0
        public async Task <IActionResult> Index()
        {
            if (_helper.CorrectDomain())
            {
                if (HttpContext.User.Identity.IsAuthenticated)
                {
                    if (HttpContext.Request.Cookies["Identity.Domain"] != HttpContext.Items["domain"] as string)
                    {
                        return(RedirectToAction("LogOut"));
                    }
                    if (HttpContext.Items["domain"] as string == "default")
                    {
                        return(RedirectToAction("Index", "Admin"));
                    }
                    else
                    {
                        var idUser = _ut.GetUserId(HttpContext.User.Identity.Name);
                        _notificationTable.NotifyCloseDeadlineTasks(idUser);
                        if (idUser == 1)
                        {
                            _notificationTable.NotifyClosePaymentExpirationDate(_tt.GetTenantId(HttpContext.Items["domain"] as string));
                        }
                        var TenantPolicyResult = await _authorization.AuthorizeAsync(User, "TenantPolicy");

                        if (TenantPolicyResult.Succeeded)
                        {
                            return(RedirectToAction("Index", "HomePage"));
                        }
                        else
                        {
                            await SignInMgr.SignOutAsync();
                        }
                    }
                }
                var model = new IndexViewModel
                {
                    Domain         = HttpContext.Items["domain"] as string,
                    SignUpSelected = false,
                    SignIn         = new SignInForm(),
                    SignUp         = new SignUpForm()
                };
                return(View(model));
            }
            else
            {
                return(RedirectToAction("DomainError", "Home"));
            }
        }
Пример #4
0
        public async Task <IActionResult> Logout()
        {
            await SignInMgr.SignOutAsync();

            return(RedirectToAction("Index", "Products"));
        }
Пример #5
0
        public async Task <IActionResult> LogOut()
        {
            await SignInMgr.SignOutAsync();

            return(Redirect("/"));
        }