Пример #1
0
        protected override XElement[] Do(WebContext context)
        {
            string currentPassword = context.httprequest.Form["currentPassword"];
            string newPassword     = context.httprequest.Form["newPassword"];

            if (newPassword != context.httprequest.Form["newPassword2"])
            {
                throw new FLocalException("new passwords mismatch");
            }
            string     registrationEmail = context.httprequest.Form["registrationEmail"];
            int        postsPerPage      = int.Parse(context.httprequest.Form["postsPerPage"]);
            int        threadsPerPage    = int.Parse(context.httprequest.Form["threadsPerPage"]);
            int        usersPerPage      = int.Parse(context.httprequest.Form["usersPerPage"]);
            int        uploadsPerPage    = int.Parse(context.httprequest.Form["uploadsPerPage"]);
            Skin       skin                 = Skin.LoadById(int.Parse(context.httprequest.Form["skinId"]));
            ModernSkin modernSkin           = ModernSkin.LoadById(int.Parse(context.httprequest.Form["modernSkinId"]));
            Machichara machichara           = Machichara.LoadById(int.Parse(context.httprequest.Form["machicharaId"]));
            int        maxUploadImageWidth  = int.Parse(context.httprequest.Form["maxUploadImageWidth"]);
            int        maxUploadImageHeight = int.Parse(context.httprequest.Form["maxUploadImageHeight"]);

            if ((postsPerPage < 1) || (postsPerPage > 200))
            {
                throw new FLocalException("wrong number for postsPerPage");
            }
            if ((threadsPerPage < 1) || (threadsPerPage > 200))
            {
                throw new FLocalException("wrong number for threadsPerPage");
            }
            if ((usersPerPage < 1) || (usersPerPage > 200))
            {
                throw new FLocalException("wrong number for usersPerPage");
            }
            if ((uploadsPerPage < 1) || (uploadsPerPage > 200))
            {
                throw new FLocalException("wrong number for uploadsPerPage");
            }

            if (!context.account.checkPassword(currentPassword))
            {
                throw new FLocalException("Wrong password. You should enter your current password in order to change settings.");
            }

            AccountSettings.Save(context.session.account, postsPerPage, threadsPerPage, usersPerPage, uploadsPerPage, skin, modernSkin, machichara, maxUploadImageWidth, maxUploadImageHeight);

            if (newPassword != null && newPassword != "")
            {
                context.account.updatePassword(newPassword);
            }

            if (registrationEmail != null && registrationEmail != "")
            {
                context.account.updateRegistrationEmail(registrationEmail);
            }

            return(new XElement[0]);
        }
Пример #2
0
 /// <summary>
 /// Method for save Account Settings.
 /// </summary>
 public void SaveAccountSettings()
 {
     AccountSettings.Save(Constants.ACCOUNT_FILE_NAME_SETTINGS, this._accSettings);
 }
Пример #3
0
		public static Task Save(this TwitterAccount account)
		{
			var settings = new AccountSettings
			{
				AccountName = account.User.ScreenName.Value,
				Tokens = account.Tokens.Select(t => t.ToSettings()).ToList(),
				CurrentApplicationId = account.CurrentToken.Application.Id,
				UseUserStreams = account.UserStreams.UseUserStreams
			};

			return settings.Save();
		}
Пример #4
0
        public override void InitialActions(string[] args)
        {
            if (!IsAdministrator())
            {
                if (args.Length < 1 || args[0] != "restarted")
                {
                    RestartAsAdmin("Uninstall restarted");
                }
                else
                {
                    MessageBoxResult result = MessageBox.Show("This uninstaller need administrator permissions in order to edit your Windows Explorer Menus.\n" +
                                                              "This is essential to remove unused menu items. Press OK to try again or Cancel to leave the items after the uninstall.", "Kallithea Klone needs administrator permissions!", MessageBoxButton.OKCancel, MessageBoxImage.Error);

                    switch (result)
                    {
                    case MessageBoxResult.OK:
                        RestartAsAdmin("Uninstall restarted");
                        break;

                    default:
                        break;
                    }
                }
                return;
            }

            try
            {
                ContextMenuImplementations.RemoveAll();
            }
            catch
            {
                MessageBox.Show("Kallithea Klone was unable to remove all Windows Explorer context menu items.",
                                "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            AccountSettings.Reset();
            AccountSettings.Save();

            try
            {
                string appDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Kallithea Klone");
                foreach (string file in Directory.GetFiles(appDataFolder))
                {
                    try
                    {
                        File.Delete(file);
                    }
                    catch
                    {
                        //If app data cannot be removed then it will have to stay
                        //This try/catch is included as well as the outer one to
                        //Allow for as many files to be removed as possible
                    }
                }
                Directory.Delete(appDataFolder);
            }
            catch
            {
                //If app data cannot be removed then it will have to stay
            }
            App.Current.Shutdown();
        }
Пример #5
0
    protected void ButtonOK_Action(object sender, EventArgs e)
    {
        string emailAddress;
        string password;
        string displayName;
        string incomingMailServer;
        string outgoingServer;
        string loginId;
        int    portIncomingServer = 80;
        int    portOutgoingServer = 80;
        bool   isIncomeSecureConnection;
        bool   isOutgoingSecureConnection;
        bool   isOutgoingWithAuthentication;

        ErrorEmailAddress.Text = "";
        ErrorPassword.Text     = "";
        ErrorDispName.Text     = "";

        if (TextBoxEmailAddress.Text.Equals(string.Empty) || !TextBoxEmailAddress.Text.Contains("@"))
        {
            ErrorEmailAddress.Text = "Enter a valid email address!";
        }
        if (TextBoxPassword.Text.Equals(string.Empty))
        {
            ErrorPassword.Text = "Enter a valid password!";
        }
        if (TextBoxDisplayName.Text.Equals(string.Empty))
        {
            ErrorDispName.Text = "Enter a valid display name!";
        }

        emailAddress       = TextBoxEmailAddress.Text;
        password           = TextBoxPassword.Text;
        displayName        = TextBoxDisplayName.Text;
        incomingMailServer = DropDownListIncomingServer.SelectedValue;

        if (CheckBoxPortIncoming.Checked)
        {
            if (!TextBoxPortIncoming.Text.Equals(string.Empty))
            {
                portIncomingServer = Convert.ToInt32(TextBoxPortIncoming.Text);
            }
        }
        if (CheckBoxPortOutgoing.Checked)
        {
            if (!TextBoxPortOutgoing.Text.Equals(string.Empty))
            {
                portOutgoingServer = Convert.ToInt32(TextBoxPortOutgoing.Text);
            }
        }

        isIncomeSecureConnection     = CheckBoxSecureConnection.Checked;
        isOutgoingSecureConnection   = CheckBoxOutgoingSecure.Checked;
        isOutgoingWithAuthentication = CheckBoxOutgoingAuthentication.Checked;

        loginId        = TextBoxLoginID.Text;
        outgoingServer = TextBoxOutgoingServer.Text;

        //These informations are going to save

        AccountSettings.AccountInfo acc_info = new AccountSettings.AccountInfo();
        acc_info.EmailAddress                 = emailAddress;
        acc_info.Password                     = password;
        acc_info.DisplayName                  = displayName;
        acc_info.IncomingMailServer           = incomingMailServer;
        acc_info.OutgoingServer               = outgoingServer;
        acc_info.LoginId                      = loginId;
        acc_info.PortIncomingServer           = portIncomingServer;
        acc_info.PortOutgoingServer           = portOutgoingServer;
        acc_info.IsIncomeSecureConnection     = isIncomeSecureConnection;
        acc_info.IsOutgoingSecureConnection   = isOutgoingSecureConnection;
        acc_info.IsOutgoingWithAuthentication = isOutgoingWithAuthentication;
        acc_info.PortIncomingChecked          = CheckBoxPortIncoming.Checked;
        acc_info.PortOutgoingChecked          = CheckBoxPortOutgoing.Checked;

        this.acc.Add(acc_info);
        AccountSettings.Save("AccountSettings", acc);
    }