Exemplo n.º 1
0
        public async Task <IActionResult> LoginClassic(InputModels.LoginInput input)
        {
            if (ModelState.IsValid)
            {
                var serviceResponse = await AccountRepository.Login(input);

                return(await this.RedirectFromService(serviceResponse, FailureCallback));
            }

            return(await FailureCallback());

            async Task <IActionResult> FailureCallback()
            {
                if (UserContext.IsAuthenticated)
                {
                    return(Redirect("/"));
                }

                await AccountRepository.SignOut();

                var viewModel = new ViewModels.Account.LoginPage {
                    Email      = input.Email,
                    RememberMe = input.RememberMe
                };

                return(View(viewModel));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Login(InputModels.LoginInput input)
        {
            if (ModelState.IsValid)
            {
                var serviceResponse = await AccountRepository.Login(input);

                return(await ForumViewResult.RedirectFromService(this, serviceResponse, FailureCallback));
            }

            return(await FailureCallback());

            async Task <IActionResult> FailureCallback()
            {
                if (AccountRepository.IsAuthenticated)
                {
                    return(RedirectToAction(nameof(Home.FrontPage), nameof(Home)));
                }

                await AccountRepository.SignOut();

                var viewModel = new ViewModels.Account.LoginPage {
                    Email      = input.Email,
                    RememberMe = input.RememberMe
                };

                return(ForumViewResult.ViewResult(this, viewModel));
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> LoginClassic()
        {
            if (UserContext.IsAuthenticated)
            {
                return(Redirect("/"));
            }

            await AccountRepository.SignOut();

            var viewModel = new ViewModels.Account.LoginPage();

            return(View(viewModel));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Login()
        {
            if (AccountRepository.IsAuthenticated)
            {
                return(RedirectToAction(nameof(Home.FrontPage), nameof(Home)));
            }

            await AccountRepository.SignOut();

            var viewModel = new ViewModels.Account.LoginPage();

            return(ForumViewResult.ViewResult(this, viewModel));
        }