public async Task <ActionResult> VerifyCode(VerifyCodeViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            Users.Infrastructure.Helpers.SignInStatus result = await SignInHelper.TwoFactorSignIn(model.Provider, model.Code, isPersistent : false, rememberBrowser : model.RememberBrowser);

            switch (result)
            {
            case Users.Infrastructure.Helpers.SignInStatus.Success:
                var ident = HttpContext.User.Identity as ClaimsIdentity;
                ident.AddClaims(AdministratorClaimsProvider.AddAdministratorAccessToRoles(this, ident));
                HttpContext.GetOwinContext().Authentication.User.AddIdentity(ident);
                return(RedirectToLocal(model.ReturnUrl));

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

            case Users.Infrastructure.Helpers.SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid code.");
                return(View(model));
            }
        }
        public void GivenIHaveEnteredIntoTheCalculator(int p0)
        {
            var          userName = TestContextCustom.Current.EnvConfig.UserCredentials[Constants.USER_CRDENTIALS_DEFAULT].UserName;
            var          password = TestContextCustom.Current.EnvConfig.UserCredentials[Constants.USER_CRDENTIALS_DEFAULT].Password;
            SignInHelper sign     = new SignInHelper();

            SignInHelper.SignInAndOpenEAndB(userName, password);
            //DesiredCapabilities caps = new DesiredCapabilities();
            //caps.SetCapability(CapabilityType.BrowserName, "chrome");
            //caps.SetCapability(CapabilityType.Version, "61");
            //caps.SetCapability(CapabilityType.Platform, "Windows 7");
            ////caps.SetCapability("deviceName", deviceName);
            ////caps.SetCapability("deviceOrientation", deviceOrientation);
            //caps.SetCapability("username", "sergii_zhuravskyi");
            //caps.SetCapability("accessKey", "50c0d526-e3f5-426f-b334-149979ef7b0c");
            //caps.SetCapability("name", TestContext.CurrentContext.Test.Name);

            ////var proxy = new PassThroughProxy();
            ////proxy.Credentials = new NetworkCredential("sergii_zhuravskyi", "50c0d526-e3f5-426f-b334-149979ef7b0c");
            //driver = new RemoteWebDriver(new Uri("http://ondemand.saucelabs.com:80/wd/hub"), caps, TimeSpan.FromSeconds(120));
            //driver.Navigate().GoToUrl("http://www.google.com");
            //StringAssert.Contains("Google", driver.Title);
            //IWebElement query = driver.FindElement(By.Name("q"));
            //query.SendKeys("Sauce Labs");
            //query.Submit();
        }
        protected void LogIn(object sender, EventArgs e)
        {
            if (IsValid)
            {
                // Validate the user password
                var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
                var signinHelper = new SignInHelper(manager, Context.GetOwinContext().Authentication);

                // This doen't count login failures towards lockout only two factor authentication
                // To enable password failures to trigger lockout, change to shouldLockout: true
                var result = signinHelper.PasswordSignIn(Email.Text, Password.Text, RememberMe.Checked, shouldLockout: false);
                switch (result)
                {
                    case SignInStatus.Success:
                        IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
                        break;
                    case SignInStatus.LockedOut:
                        Response.Redirect("/Account/Lockout");
                        break;
                    case SignInStatus.RequiresTwoFactorAuthentication:
                        Response.Redirect("/Account/TwoFactorSignIn?ReturnUrl=" + Request.QueryString["ReturnUrl"],true);
                        break;
                    case SignInStatus.Failure:
                    default:
                        FailureText.Text = "Invalid login attempt";
                        ErrorMessage.Visible = true;
                        break;
                }
            }
        }
        protected void Page_Load()
        {
            // Process the result from an auth provider in the request
            ProviderName = IdentityHelper.GetProviderNameFromRequest(Request);
            if (String.IsNullOrEmpty(ProviderName))
            {
                RedirectOnFail();
                return;
            }
            if (!IsPostBack)
            {
                var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
                var signinHelper = new SignInHelper(manager, Context.GetOwinContext().Authentication);
                var loginInfo = Context.GetOwinContext().Authentication.GetExternalLoginInfo();
                if (loginInfo == null)
                {
                    RedirectOnFail();
                    return;
                }
                var signInStatus = signinHelper.ExternalSignIn(loginInfo, false);

                switch (signInStatus)
                {
                    case SignInStatus.Success:
                        IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
                        break;
                    case SignInStatus.LockedOut:
                        Response.Redirect("/Account/Lockout");
                        break;
                    case SignInStatus.RequiresTwoFactorAuthentication:
                        Response.Redirect("/Account/TwoFactorSignIn?ReturnUrl=" + Request.QueryString["ReturnUrl"], true);
                        break;
                }
                if (User.Identity.IsAuthenticated)
                {
                    // Apply Xsrf check when linking
                    var verifiedloginInfo = Context.GetOwinContext().Authentication.GetExternalLoginInfo(IdentityHelper.XsrfKey, User.Identity.GetUserId());
                    if (verifiedloginInfo == null)
                    {
                        RedirectOnFail();
                        return;
                    }

                    var result = manager.AddLogin(User.Identity.GetUserId(), verifiedloginInfo.Login);
                    if (result.Succeeded)
                    {
                        IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
                    }
                    else
                    {
                        AddErrors(result);
                        return;
                    }
                }
                else
                {
                    email.Text = loginInfo.Email;
                }
            }
        }
예제 #5
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    await SignInHelper.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // 有关如何启用帐户确认和密码重置的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=320771
                    // 发送包含此链接的电子邮件
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "确认你的帐户", "请通过单击 <a href=\"" + callbackUrl + "\">這裏</a>来确认你的帐户");

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(View(model));
        }
예제 #6
0
        public void TestTextFilter()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver);

                Console.WriteLine("Setting filter to include two games...");
                var filter = "in";
                FilterHelper.SetTextFilter(driver, filter);
                driver.WaitUntil(d => GameSummaryHelper.GetGameCount(driver) == 2, Invariant($"Could not verify filter {filter}"));
                AssertActiveFilterNotifications(driver, true);
                CollectionAssert.AssertEqualSets(new[] { GameConstants.RoninSteamName, GameConstants.GodsWillBeWatchingSteamName },
                                                 TableHelper.ParseGameTable(driver).Select(g => g.SteamName), Invariant($"Could not verify filter {filter}"));

                Console.WriteLine("Setting filter to exclude all games...");
                filter = Guid.NewGuid().ToString();
                FilterHelper.SetTextFilter(driver, filter);
                driver.WaitUntil(d => GameSummaryHelper.GetGameCount(driver) == 0, Invariant($"Could not verify filter {filter}"));
                AssertActiveFilterNotifications(driver, true);

                Console.WriteLine("Clearing filter...");
                FilterHelper.ClearTextFilter(driver);
                driver.WaitUntil(d => GameSummaryHelper.GetGameCount(driver) == 3, "Could not verify cleared filter");
                AssertActiveFilterNotifications(driver, false);
            });
        }
예제 #7
0
        public void TestUpdateSuggestions()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver);

                var gameRows = TableHelper.FindGameRows(driver).ToArray();

                Console.WriteLine("Updating HLTB correlation...");
                DialogHelper.TestDialog(driver, gameRows[0].FindElement(By.ClassName(SiteConstants.RowWrongGameAnchorClass)), SiteConstants.HltbUpdateModalId, () =>
                {
                    driver.FindElement(By.Id(SiteConstants.HltbUpdateInputId)).SetText("123");
                    driver.FindElement(By.Id(SiteConstants.HltbUpdateSubmitButtonId)).Click();
                });

                Console.WriteLine("Waiting for correlation suggestion to be submitted...");
                driver.WaitUntil(d => TableHelper.ParseGameRow(driver, gameRows[0]).UpdateState == UpdateState.Submitted, "Could not verify successful correlation submission");

                Console.WriteLine("Suggesting non-game...");
                DialogHelper.TestDialog(driver, gameRows[1].FindElement(By.ClassName(SiteConstants.RowVerifyGameAnchorId)), SiteConstants.NonGameUpdateModalId, () =>
                {
                    driver.FindElement(By.Id(SiteConstants.NonGameUpdateButtonId)).Click();
                });

                Console.WriteLine("Waiting for non-game suggestion to be submitted...");
                driver.WaitUntil(d =>
                {
                    var gameInfo = TableHelper.ParseGameRow(driver, gameRows[1]);
                    return(gameInfo.UpdateState == UpdateState.Submitted && !gameInfo.Included);
                }, "Could not verify successful non-game submission");
            });
        }
예제 #8
0
        protected void LogIn(object sender, EventArgs e)
        {
            if (IsValid)
            {
                // Validate the user password
                var manager      = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
                var signinHelper = new SignInHelper(manager, Context.GetOwinContext().Authentication);

                // This doen't count login failures towards lockout only two factor authentication
                // To enable password failures to trigger lockout, change to shouldLockout: true
                var result = signinHelper.PasswordSignIn(Email.Text, Password.Text, RememberMe.Checked, shouldLockout: false);
                switch (result)
                {
                case SignInStatus.Success:
                    IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
                    break;

                case SignInStatus.LockedOut:
                    Response.Redirect("/Account/Lockout");
                    break;

                case SignInStatus.RequiresTwoFactorAuthentication:
                    Response.Redirect("/Account/TwoFactorSignIn?ReturnUrl=" + Request.QueryString["ReturnUrl"], true);
                    break;

                case SignInStatus.Failure:
                default:
                    FailureText.Text     = "Invalid login attempt";
                    ErrorMessage.Visible = true;
                    break;
                }
            }
        }
        public async Task <ActionResult> Login(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            //NC Start of auto login code - always auto sign in as guest, copied from the guest post code!
            GuestViewModel model = new GuestViewModel {
                GuestAcct = "*****@*****.**", GuestPassword = "******"
            };
            var result = await SignInHelper.PasswordSignIn(model.GuestAcct, model.GuestPassword, false, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                return(RedirectToLocal(returnUrl));

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

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

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
            //NC - End of auto sign in code
            return(View());
        }
예제 #10
0
        public void RequestPermissions(string[] scopes, Action <SignInStatus> callback)
        {
            using (var bridgeClass = new AndroidJavaClass(HelperFragmentClass))
                using (var currentActivity = AndroidHelperFragment.GetActivity())
                    using (var task =
                               bridgeClass.CallStatic <AndroidJavaObject>("showRequestPermissionsUi", currentActivity,
                                                                          oauthScopes.Union(scopes).ToArray()))
                    {
                        AndroidTaskUtils.AddOnSuccessListener <AndroidJavaObject>(task, /* disposeResult= */ false,
                                                                                  accountWithNewScopes =>
                        {
                            if (accountWithNewScopes == null)
                            {
                                callback(SignInStatus.InternalError);
                                return;
                            }

                            account     = accountWithNewScopes;
                            email       = account.Call <string>("getEmail");
                            idToken     = account.Call <string>("getIdToken");
                            authCode    = account.Call <string>("getServerAuthCode");
                            oauthScopes = oauthScopes.Union(scopes).ToList();
                            callback(SignInStatus.Success);
                        });

                        AndroidTaskUtils.AddOnFailureListener(task, e =>
                        {
                            var failCode = SignInHelper.ToSignInStatus(e.Call <int>("getStatusCode"));
                            OurUtils.Logger.e("Exception requesting new permissions: " + failCode);
                            callback(failCode);
                        });
                    }
        }
예제 #11
0
        private static void AssertSurvival(IWebDriver driver, Gender gender, int birthYear, int weeklyPlaytime, PlayStyle playStyle, bool expectSurvival)
        {
            SignInHelper.SignInWithId(driver, UserConstants.SampleSteamId);
            SurvivalHelper.CalculateSurvival(driver, gender, birthYear, weeklyPlaytime, playStyle);

            Console.WriteLine("Parsing backlog completion date...");
            var backlogCompletion = TestUtil.ParseBrowserDate(driver, driver.FindElement(By.Id(SiteConstants.SurvivalBacklogCompletionLabelId)).Text);

            Console.WriteLine("Parsing time of death date...");
            var timeOfDeath = TestUtil.ParseBrowserDate(driver, driver.FindElement(By.Id(SiteConstants.SurvivalTimeOfDeathLabelId)).Text);

            Console.WriteLine("Asserting expected results...");
            bool survival = timeOfDeath >= backlogCompletion;

            if (expectSurvival)
            {
                Assert.IsTrue(survival, "Expected time of death to come after backlog completion");
                Assert.IsTrue(driver.FindElement(By.Id(SiteConstants.SurvivalSuccessImgId)).Displayed, "Expected backlog completion success");
            }
            else
            {
                Assert.IsFalse(survival, "Expected time of death to come before backlog completion");
                Assert.IsTrue(driver.FindElement(By.Id(SiteConstants.SurvivalFailureImgId)).Displayed, "Expected backlog completion failure");
            }
        }
예제 #12
0
        public ActionResult LogOff()
        {
            var _signInHelper = new SignInHelper(AuthenticationManager);

            _signInHelper.SignOut();

            return(Redirect("/auth"));
        }
예제 #13
0
 public void TestTableEntries()
 {
     SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
     {
         SignInHelper.SignInWithId(driver);
         AssertHltbsUserTable(TableHelper.ParseGameTable(driver), false);
     });
 }
예제 #14
0
 public void TestMobileTableEntries()
 {
     SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
     {
         SignInHelper.SignInWithId(driver);
         AssertHltbsUserTable(TableHelper.ParseGameTable(driver), true);
     }, Browsers.Nexus7Chrome);
 }
예제 #15
0
 public void TestSignInWithInvalidUsername()
 {
     SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
     {
         SignInHelper.SignInWithId(driver, Guid.NewGuid().ToString(), WaitType.None);
         driver.WaitUntilElementIsVisible(By.Id(SiteConstants.LoginErrorDivId), "Could not locate login error notification");
     });
 }
예제 #16
0
 public void TestNoShareLinksOnMissingGamesPage()
 {
     SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
     {
         SignInHelper.GoToMissingGamesPage(driver);
         AssertNoShareLinks(driver);
     });
 }
예제 #17
0
 public void TestSignInWithNoGames()
 {
     SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
     {
         SignInHelper.SignInWithId(driver, UserConstants.SampleNoGamesUserId, WaitType.None);
         driver.WaitUntilElementIsVisible(By.Id(SiteConstants.EmptyLibraryDivId), "Could not locate empty library notification");
     });
 }
예제 #18
0
        /// <summary>
        /// A beagle tag user can log in to receive a list of tags that are associated to them
        /// </summary>
        /// <param name="email"></param>
        /// <param name="password"></param>
        /// <returns></returns>
         public async Task<JsonResult> Login (string email, string password)
        {
            if (email == null || password == null)
            {
                return Json(new
                {
                    success = false,
                    message = "missing one or more parameters",
                    UID = "",
                }, JsonRequestBehavior.AllowGet);
            }

             string UID = "";
             List<IdentitySample.Models.Tag> tags = new List<Models.Tag>();
             bool success = false;
             var message = "";

             //make the login call
            // This doen't count login failures towards lockout only two factor authentication
            // To enable password failures to trigger lockout, change to shouldLockout: true

            var uM = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
            var aM = HttpContext.GetOwinContext().Authentication;
            var signInHelper = new SignInHelper(uM, aM);
            var result = await signInHelper.PasswordSignIn(email, password, false, shouldLockout: false);

             if(result == SignInStatus.Success)
             {
                 var test2 = ZDB.Users;
                 var user = await ZDB.Users.Find(x => x.UserName == email).FirstOrDefaultAsync();
                 if(user != null)
                 {
                     //get the fields we need
                     UID = user.Id;
                     tags = user.Tags;
                     success = true;
                     //update the user
                     await ZDB.Users.UpdateOneAsync(x => x.UserName == email, Builders<ApplicationUser>.Update.Set(x => x.LastLogin, DateTime.UtcNow));
                 }
                 else
                 {
                     message = "error talking to database";
                 } 
             }
             else
             {
                 message = result.ToString();
             }
             var test = User.Identity.GetUserId();
            return Json(new
            {
                success = success,
                message = message,
                UID = UID,
                tags = tags

            }, JsonRequestBehavior.AllowGet);
        }
예제 #19
0
        public void TestPageLinks()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver);

                AssertPageLinks(driver);
            });
        }
예제 #20
0
 public void TestMissingGamesLinks()
 {
     SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
     {
         SignInHelper.GoToMissingGamesPage(driver);
         Assert.IsTrue(driver.FindElement(By.Id(SiteConstants.CachedGamesPanelId)).Displayed, "Expected cached games pane to be visible in missing games page");
         Assert.IsFalse(driver.FindElement(By.Id(SiteConstants.MissingGamesLinkId)).Displayed, "Expected missing games link to be hidden in missing games page");
     });
 }
예제 #21
0
        public void TestCachedRenderedCharts()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.GoToCachedGamesPage(driver);

                TestRenderedCharts(driver);
                TestSlicers(driver);
            });
        }
예제 #22
0
        public void TestProperLinks()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver, UserConstants.SampleSteamId);

                AssertInternalLinks(driver);
                AssertExternalLinks(driver);
            }, Browsers.Chrome | Browsers.Firefox); //IE behaves strangely and it doesn't really matter as these links are simple hrefs
        }
예제 #23
0
        public void TestMobileRenderedCharts()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver);

                TestRenderedCharts(driver);
                TestSlicers(driver);
            }, Browsers.IPhone);
        }
        public async Task <ActionResult> Login(LoginViewModel details)
        {
            string returnUrl = TempData["returnUrl"] == null ? "" : TempData["returnUrl"].ToString();

            if (ModelState.IsValid)
            {
                AppUser user = await UserManager.FindAsync(details.UserName,
                                                           details.Password);

                if (user == null)
                {
                    ModelState.AddModelError("", "Невалидно потребителско име или парола!");
                }
                else
                {
                    ClaimsIdentity ident = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);

                    ident.AddClaims(AdministratorClaimsProvider.AddAdministratorAccessToRoles(this, ident));
                    AuthManager.SignOut();

                    AuthManager.SignIn(new AuthenticationProperties {
                        IsPersistent = false
                    }, ident);



                    if (!user.IsGoogleAuthenticatorEnabled)
                    {
                        return(RedirectToAction("EnableGoogleAuthenticator", new { returnUrl = returnUrl, userName = user.UserName }));
                    }

                    Infrastructure.Helpers.SignInStatus result = await SignInHelper.PasswordSignIn(details.UserName, details.Password, false, shouldLockout : false);

                    switch (result)
                    {
                    case Infrastructure.Helpers.SignInStatus.Success:
                        return(RedirectToLocal(returnUrl));

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

                    case Infrastructure.Helpers.SignInStatus.RequiresTwoFactorAuthentication:
                        return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl }));

                    case Infrastructure.Helpers.SignInStatus.Failure:
                    default:
                        ModelState.AddModelError("", "Invalid login attempt.");
                        return(View(details));
                    }
                }
            }

            TempData["returnUrl"] = returnUrl;
            return(View(details));
        }
예제 #25
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            userManager = new UserManager(new UserStore(new LogistoDb()), Startup.IdentityFactoryOptions, new EmailService());

            // Валидация входных данных: проверка на корректность
            var login            = model.Login;
            var loginValidity    = SignInHelper.ValidateLogin(ref login);
            var passwordValidity = userManager.PasswordValidator.ValidateAsync(model.Password).Result;

            if (!loginValidity.Succeeded || !passwordValidity.Succeeded)
            {
                ModelState.AddModelError("", "LoginFormWrongInputMessage");
                return(View(model));
            }

            // This doen't count login failures towards lockout only two factor authentication
            // To enable password failures to trigger lockout, change to shouldLockout: true

            var result = await new SignInHelper(userManager, AuthenticationManager).PasswordSignIn(login, model.Password, /*model.RememberMe*/ true, shouldLockout: false);

            switch (result)
            {
            case Logisto.Identity.SignInStatus.Success:
                if (model.Password == "123456789")
                {
                    return(RedirectToAction("ChangePassword"));
                }

                if (!string.IsNullOrWhiteSpace(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }

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

            case Logisto.Identity.SignInStatus.RequiresTwoFactorAuthentication:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl }));

            case Logisto.Identity.SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Неверный логин или пароль");
                return(View(model));
            }
        }
예제 #26
0
        public void TestSignInWithSteamId64()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver, UserConstants.SampleSteam64Id.ToString(CultureInfo.InvariantCulture));
                AssertPersonaDetails(driver, UserConstants.SamplePersonaName, UserConstants.SamplePersonaAvatarUuid);

                Console.WriteLine("Asserting the imputed values notification is displayed...");
                driver.FindElement(By.Id(SiteConstants.ImputedValuesNotificationDivId));
            });
        }
예제 #27
0
        public void TestCachedGamesPage()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.GoToCachedGamesPage(driver);
                AssertPersonaDetails(driver, String.Empty, UserConstants.SamplePersonaAvatarUuid);

                Console.WriteLine("Asserting the missing HLTB games alert is displayed...");
                driver.FindElement(By.Id(SiteConstants.MissingHltbGamesAlertDivId));
            });
        }
예제 #28
0
 public void TestMissingGames()
 {
     SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
     {
         SignInHelper.GoToMissingGamesPage(driver);
         driver.WaitUntil(d =>
         {
             var games = TableHelper.ParseGameTable(d);
             return(games.Length >= 10 && games.All(g => g.MissingCorrelation));
         }, Invariant($"Could not verify missing games page"));
     });
 }
예제 #29
0
        public void TestMobileLinks()
        {
            // If this test fails, try clicking via JS https://stackoverflow.com/a/17569061/67824
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver);

                AssertPageLinks(driver);
                AssertInternalLinks(driver);
                AssertExternalLinks(driver);
            }, Browsers.OptimusL70Chrome);
        }
예제 #30
0
        public void TestGameSummary()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver);

                Assert.AreEqual(UserConstants.HltbUserGameCount, GameSummaryHelper.GetGameCount(driver), "incorrect game count");
                Assert.AreEqual(UserConstants.HltbUserExcludedGameCount, GetExcludedGameCount(driver), "incorrect excluded game count");

                AssertValidPlaytimes(driver);
                AssertValidPercentages(driver);
            });
        }
예제 #31
0
        public void TestCachedGameSummary()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.GoToCachedGamesPage(driver);

                var gameCount = GameSummaryHelper.GetGameCount(driver);
                Assert.IsTrue(gameCount > 10000, Invariant($"too few games in cache: {gameCount}"));
                Assert.AreEqual(0, GetExcludedGameCount(driver), "expected zero excluded games in cached page");

                AssertValidPlaytimes(driver);
                AssertValidPercentages(driver);
            });
        }
예제 #32
0
        public void TestTableSort()
        {
            SeleniumExtensions.ExecuteOnMultipleBrowsers(driver =>
            {
                SignInHelper.SignInWithId(driver);

                TestColumnSort(driver, SiteConstants.SteamNameTitle, g => g.SteamName);
                TestColumnSort(driver, SiteConstants.SteamPlaytimeTitle, g => g.SteamPlaytime);
                TestColumnSort(driver, SiteConstants.MainPlaytimeTitle, g => g.MainPlaytime);
                TestColumnSort(driver, SiteConstants.ExtrasPlaytimeTitle, g => g.ExtrasPlaytime);
                TestColumnSort(driver, SiteConstants.CompletionistPlaytimeTitle, g => g.CompletionistPlaytime);
                TestColumnSort(driver, SiteConstants.HltbNameTitle, g => g.HltbName);
            });
        }
        public async Task <ActionResult> SendCode(SendCodeViewModel model)
        {
            // Generate the token and send it
            if (!ModelState.IsValid)
            {
                return(View());
            }

            if (!await SignInHelper.SendTwoFactorCode(model.SelectedProvider))
            {
                return(View("Error"));
            }
            return(RedirectToAction("VerifyCode", new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl }));
        }
예제 #34
0
 public AccountController(SignInHelper signInHelper)
 {
     _signInHelper = signInHelper;
 }
 public TwoFactorSignIn()
 {
     manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
     signinHelper = new SignInHelper(manager, Context.GetOwinContext().Authentication);
 }