Exemple #1
0
        public async Task <IActionResult> VerifyCode(VerifyCodeInputModel model, string button)
        {
            var code     = HttpContext.Session.GetString("_code");
            var username = HttpContext.Session.GetString("_user");

            var user = _users.FindByUsername(username);

            if (code == model.VerificationCode)
            {
                var isuser = new IdentityServerUser(user.SubjectId)
                {
                    DisplayName = user.Username
                };

                AuthenticationProperties props = null;

                props = new AuthenticationProperties
                {
                    IsPersistent = true,
                    ExpiresUtc   = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration)
                };

                await HttpContext.SignInAsync(isuser, props);

                return(Redirect("~/diagnostics"));
            }


            ModelState.AddModelError(string.Empty, AccountOptions.InvalidVerificationCodeErrorMessage);



            //var vm = await BuildLoginViewModelAsync(model);
            return(View(model));
        }/// <summary>
Exemple #2
0
        public async Task <IActionResult> VerifyCode(string returnUrl)
        {
            // build a model so we know what to show on the login page

            var model = new VerifyCodeInputModel();

            return(View(model));
        }