public ResourceResult Get(HomeUrl url) { return OK(new HomeViewModel { Brandings = brands.GetThem() }); }
public ActionResult Get(HomeUrl url) { return OK(new HomeViewModel { BooksLink = new BooksUrl().ToString() }); }
protected override void AssertSecureLoginUrl() { var url = HomeUrl.AsNonReadOnly(); url.Scheme = Uri.UriSchemeHttps; AssertUrl(url); }
public ResourceResult Get(HomeUrl url) { return OK(new HomeViewModel { Gigs = counts.Gigs, RepeatingGigs = counts.RepeatingGigs, StolenGear = counts.StolenGear }).AsHtml(); }
private void SetAuthCookie(string value) { foreach (Cookie cookie in Browser.Cookies.GetCookies(new Uri(HomeUrl.ToString()))) { if (cookie.Name == "LinkMeAuth") { cookie.Value = value; break; } } }
public void TestCidParameter() { var homeUrl = HomeUrl.AsNonReadOnly(); homeUrl.QueryString["cid"] = "BP-BP.com-Head-Tabs-jobs"; Get(homeUrl); // Make sure a redirect occurred stripping out the parameter. AssertUrl(HomeUrl); }
public void TestDisable() { var host = HomeUrl.Host; // Create the member. var vertical = CreateVertical(); var member = CreateMember(true, true, vertical.Id); // Log in as the member. var url = vertical.GetVerticalHostUrl(""); var verticalHost = url.Host; CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName, vertical.ExternalCookieDomain); Get(url); var homeUrl = LoggedInMemberHomeUrl.AsNonReadOnly(); homeUrl.Host = verticalHost; AssertUrl(homeUrl); LogOut(); // Login. var administrator = _administratorAccountsCommand.CreateTestAdministrator(0); homeUrl = HomeUrl.AsNonReadOnly(); homeUrl.Host = host; Get(homeUrl); LogIn(administrator); Get(GetMemberUrl(member)); // Disable. _disableButton.Click(); // Check the member details. member.IsEnabled = false; AssertMember(member); // Check the member login. LogOut(); url = vertical.GetVerticalHostUrl(""); CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName, vertical.ExternalCookieDomain); Get(url); var externalLoginUrl = new ReadOnlyUrl(vertical.ExternalLoginUrl, new ReadOnlyQueryString("returnUrl", url.AbsoluteUri)); AssertUrl(externalLoginUrl); }
public void TestMemberHome() { Assert.AreEqual("http", HomeUrl.Scheme); Get(HomeUrl); AssertUrl(HomeUrl); var url = HomeUrl.AsNonReadOnly(); url.Scheme = "https"; Assert.AreEqual("https", url.Scheme); Get(url); AssertUrl(HomeUrl); }
public ResourceResult Get(HomeUrl url) { var counts = gigs.Counts(DateTime.Now.Date); return OK(new HomeViewModel { Month = new DateTimeFormatInfo().GetMonthName(DateTime.Now.Month), TotalGigs = counts.TotalGigs, FutureGigs = counts.FutureGigs, BandCount = counts.Bands, VenueCount = counts.Venues, ThisWeek = gigs.Week(DateTime.Now.Date), RecentlyUpdated = otherGigs.RecentlyUpdated().Select(x => new RecentlyChangedInfo(x)).ToArray() }).AsHtml(); }
/// <summary> /// OnParametersSetAsync 方法 /// </summary> protected override void OnParametersSet() { if (NavigationManager != null) { RequestUrl = new UriBuilder(NavigationManager.Uri).Path; Model = new NavigatorBarModel(UserName, RequestUrl.ToMvcMenuUrl()); DisplayName = Model.DisplayName; WebTitle = Model.Title; WebFooter = Model.Footer; if (HomeUrl.StartsWith("/")) { HomeUrl = NavigationManager.ToBlazorLink(HomeUrl); } } }
protected override void AssertUpdate(bool alreadyJoined) { // Log in with new email address. LogOut(); Get(HomeUrl); SubmitLogIn(EmailAddress, Password); var homeUrl = HomeUrl.AsNonReadOnly(); homeUrl.Scheme = Uri.UriSchemeHttps; AssertUrl(homeUrl); AssertPageContains("Login failed. Please try again."); SubmitLogIn(NewEmailAddress, Password); AssertUrl(_notActivatedUrl); }
/// <summary> /// Get only nested object claims /// </summary> public List <BaseIdentification> GetNestedClaims() { var claims = new List <BaseIdentification> { new BaseIdentification(SsoClaimTypes.SsoApp, Id), new BaseIdentification(SsoClaimTypes.SsoAppMnemonic, Id + "|" + (Mnemonic ?? Id)) }; if (!string.IsNullOrEmpty(HomeUrl)) { claims.Add(new BaseIdentification(SsoClaimTypes.SsoAppHomeUrl, Id + "|" + HomeUrl.Trim())); } //Add Sso profiles, services and groups into claims list claims.AddRange(Profiles.SelectMany(pro => pro.GetClaims())); return(claims.Distinct(new EqualBy <BaseIdentification>((x, y) => x.Id == y.Id && x.NameOrDescription == y.NameOrDescription)).ToList()); }
public ResourceResult Get(HomeUrl url) { return OK(home.GetResource()) .AsHtml(); }
private async Task LoginAsync(CancellationToken token) { // 步骤0 GET 测试网络可用性 Net.SetReferer(HomeUrl); try { var homerespose = await Net.Client.GetAsync("https://www.pixiv.net/", token); if (!homerespose.IsSuccessStatusCode) { throw new Exception("!homerespose.IsSuccessStatusCode"); } } catch (Exception e) { App.Log(e); App.ShowMessage("无法连接至https://www.pixiv.net,请检查代理设置"); return; } // 步骤1 GET 获取 post_key 参数 App.ShowMessage("pixiv.net自动登录中", 1); const string loginurl = "https://accounts.pixiv.net/login?lang=zh&source=pc&view_type=page&ref="; var data = await Net.Client.GetStringAsync(loginurl); var hdoc = new HtmlDocument(); hdoc.LoadHtml(data); var postKey = hdoc.DocumentNode.SelectSingleNode("//input[@name='post_key']").Attributes["value"].Value; if (string.IsNullOrWhiteSpace(postKey) || postKey.Length < 9) { App.Log(ShortName, "自动登录失败(获取post_key失败)"); App.ShowMessage("pixiv.net自动登录失败"); return; } // 步骤2 POST 登录获取Cookie var uindex = new Random().Next(0, _user.Length); var content = new FormUrlEncodedContent(new Dictionary <string, string> { { "pixiv_id", _user[uindex] }, { "captcha", "" }, { "password", _pass[uindex] }, { "post_key", postKey }, { "source", "pc" }, { "ref", "wwwtop_accounts_index" }, { "return_to", HomeUrl.ToEncodedUrl() } }); try { Net.SetReferer("https://accounts.pixiv.net/login?lang=zh&source=pc&view_type=page&ref=wwwtop_accounts_index"); const string loginpost = "https://accounts.pixiv.net/api/login?lang=zh"; var response = await Net.Client.PostAsync(loginpost, content, token); if (response.IsSuccessStatusCode) { IsLogin = true; App.ShowMessage("pixiv.net登录成功,获取页面中", 1); } else { throw new Exception("步骤2 POST 登录获取Cookie response.IsSuccessStatusCode == false"); } } catch (Exception e) { App.Log(e); App.ShowMessage("pixiv.net自动登录失败"); return; } }