public async Task <Http.Client> GetAuthedClient()
        {
            Helpers.Cookie[] cookies;
            if (Consts.IsServer || IsCloudFlareProtected)
            {
                try
                {
                    cookies = await Utils.FromEncryptedJson <Helpers.Cookie[]>(_encryptedKeyName);

                    if (cookies != null)
                    {
                        return(Helpers.GetClient(cookies, SiteURL.ToString()));
                    }
                }
                catch (FileNotFoundException) { }

                cookies = await Utils.Log(new RequestSiteLogin(this)).Task;

                return(Helpers.GetClient(cookies, SiteURL.ToString()));
            }

            cookies = await ClientAPI.GetAuthInfo <Helpers.Cookie[]>(_encryptedKeyName);

            var client = Helpers.GetClient(cookies, SiteURL.ToString());

            return(client);
        }
Exemplo n.º 2
0
        public async Task <HttpClient> GetAuthedClient()
        {
            Helpers.Cookie[] cookies;
            try
            {
                cookies = Utils.FromEncryptedJson <Helpers.Cookie[]>(_encryptedKeyName);
                if (cookies != null)
                {
                    return(Helpers.GetClient(cookies, SiteURL.ToString()));
                }
            }
            catch (FileNotFoundException) { }

            cookies = await Utils.Log(new RequestSiteLogin(this)).Task;

            return(Helpers.GetClient(cookies, SiteURL.ToString()));
        }
Exemplo n.º 3
0
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            try
            {
                // SPSecurity.RunWithElevatedPrivileges(delegate()
                //{
                string parentSiteURL = GetParentSiteURL();
                using (SPSite parentSite = new SPSite(parentSiteURL, __Context.Web.CurrentUser.UserToken))
                {
                    using (SPWeb parentWeb = parentSite.OpenWeb())
                    {
                        SPUser user2 = parentWeb.CurrentUser;

                        string webRelativeURL = SiteURL.Substring(parentWeb.Url.Length + 1);
                        if (String.IsNullOrEmpty(SiteDescription))
                        {
                            SiteDescription = "";
                        }

                        SPWeb subsite = parentWeb.Webs.Add(webRelativeURL, SiteTitle, SiteDescription, LCID, TemplateID, UseUniquePermissions, ConvertIfExists);
                        subsite.Navigation.UseShared = true;

                        Result = subsite.Url;

                        string message = "Provisioning " + SiteTitle + " at " + SiteURL;
                        WorkflowHistoryLogger.LogMessage(executionContext, SPWorkflowHistoryEventType.None, "Complete", UserID, message);
                    }
                }
                //});
            }
            catch (Exception ex)
            {
                WorkflowHistoryLogger.LogError(executionContext, UserID, ex);
                return(ActivityExecutionStatus.Faulting);
            }
            return(ActivityExecutionStatus.Closed);
        }
Exemplo n.º 4
0
 public override int GetHashCode()
 {
     return(SiteTitle.GetHashCode() ^ SiteURL.GetHashCode());
 }
Exemplo n.º 5
0
 string GetParentSiteURL()
 {
     string[] urlParts = SiteURL.Split('/');
     return(string.Join("/", urlParts, 0, urlParts.Length - 1));
 }
 private void TextboxPadderClicked(object sender, EventArgs e)
 {
     SiteURL.Focus();
 }