Exemplo n.º 1
0
        public async Task <ActionResult> SideNav()
        {
            var email = TempData["Email"].ToString();
            AccountsRepository accountsRepository = new AccountsRepository();
            ApplicationUser    data = await accountsRepository.GetInfoAsync(email);

            TempData["ImageUrl"] = data.Picture;
            TempData.Keep();
            return(View());
        }
Exemplo n.º 2
0
        //[ValidateAntiForgeryToken]
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                TempData["InEmailPassword"] = "******";
                return(View("Login"));
            }
            else
            {
                var result = await WebApiController.Login(model, returnUrl);

                switch (result)
                {
                case SignInStatus.Success:
                    TempData["Login"]        = "******";
                    TempData["access_token"] = token;
                    TempData["Email"]        = model.Email;
                    AccountsRepository accountsRepository = new AccountsRepository();
                    ApplicationUser    data = await accountsRepository.GetInfoAsync(model.Email);

                    TempData["UserID"] = data.Id;
                    return(RedirectToAction("GetNotes", "Notes"));

                case SignInStatus.LockedOut:
                    return(View("Lockout"));

                case SignInStatus.RequiresVerification:
                    return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

                case SignInStatus.Failure:
                default:
                    TempData["LoginFaliure"] = "Invalid Login attempt";
                    return(View("Login"));
                }
            }
        }