internal override int ValidatePage(int currentIndex)
        {
            if (ifWebService.GetSecurityPolicy(this.SelectedDomain.ID) == 0)
            {
                MessageBox.Show(TrayApp.Properties.Resources.encryptionNotSet, TrayApp.Properties.Resources.encryptionNotSetHeading, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else if (!simiasWebService.IsPassPhraseSet(this.SelectedDomain.ID))
            {
                MessageBox.Show(TrayApp.Properties.Resources.passphraseNotSet, TrayApp.Properties.Resources.passphraseNotSetHeading, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                string RAName = this.ifWebService.GetRAName(SelectedDomain.ID);

                if (RAName != "DEFAULT" && RAName != null)
                {
                    currentIndex = wizard.MaxPages - 8;
                }

                else
                {
                    currentIndex = wizard.MaxPages - 9;
                }

                currentIndex = base.ValidatePage(currentIndex);
            }
            return(currentIndex);
        }
Exemple #2
0
        /// <summary>
        /// Event Handler for domains select index changed event
        /// </summary>
        private void Domains_SelectedIndexChanged(object sender, EventArgs e)
        {
            DomainItem domain         = (DomainItem)Domains.SelectedItem;
            int        SecurityPolicy = ifws.GetSecurityPolicy(domain.ID);

            this.encryptionCB.Checked = true;
            this.encryptionCB.Enabled = this.sharedCB.Enabled = false;
            this.sharedCB.Checked     = false;
            if (SecurityPolicy != 0)
            {
                if ((SecurityPolicy & (int)SecurityState.encryption) == (int)SecurityState.encryption)
                {
                    if ((SecurityPolicy & (int)SecurityState.enforceEncryption) == (int)SecurityState.enforceEncryption)
                    {
                        encryptionCB.Checked = true;
                    }
                    else
                    {
                        encryptionCB.Enabled = true;
                        sharedCB.Enabled     = true;
                    }
                }
                else
                {
                    sharedCB.Checked = true;
                }
            }
            else
            {
                sharedCB.Checked = true;
            }
        }
Exemple #3
0
 /// <summary>
 /// Update UI
 /// </summary>
 private void UpdateUI()
 {
     if (ifws.GetSecurityPolicy(Domain) != 0 && simws.IsPassPhraseSet(Domain))
     {
         BrowseButton.Sensitive = location.Sensitive = oneTimePassphrase.Sensitive = retypePassPhrase.Sensitive = passPhrase.Sensitive = true;
     }
     else
     {
         BrowseButton.Sensitive = location.Sensitive = oneTimePassphrase.Sensitive = retypePassPhrase.Sensitive = passPhrase.Sensitive = false;
     }
 }
Exemple #4
0
 /// <summary>
 /// Update UI
 /// </summary>
 private void UpdateUI()
 {
     if (ifws.GetSecurityPolicy(this.Domain) != 0 && simws.IsPassPhraseSet(this.Domain))
     {
         location.Sensitive = BrowseButton.Sensitive = true;
     }
     else
     {
         location.Sensitive = BrowseButton.Sensitive = false;
     }
 }
Exemple #5
0
 /// <summary>
 /// Update UI
 /// </summary>
 private void UpdateUI()
 {
     if ((ifws.GetSecurityPolicy(DomainID) != 0 && simiasWebservice.IsPassPhraseSet(DomainID)))
     {
         this.passPhrase.Enabled = this.newPassphrase.Enabled = this.retypePassphrase.Enabled = recoveryAgentCombo.Enabled = rememberPassphrase.Enabled = true;
     }
     else
     {
         this.passPhrase.Enabled = this.newPassphrase.Enabled = this.retypePassphrase.Enabled = recoveryAgentCombo.Enabled = rememberPassphrase.Enabled = false;
     }
 }
 /// <summary>
 /// Update UI
 /// </summary>
 private void UpdateUI()
 {
     //check if encryption is enabled or not. If not yet enabled then disable the option to reset the PP.
     if (ifws.GetSecurityPolicy(this.DomainID) != 0 && simws.IsPassPhraseSet(this.DomainID))
     {
         oldPassPhrase.Sensitive = newPassPhrase.Sensitive = retypePassPhrase.Sensitive = recoveryAgentCombo.Sensitive = savePassPhrase.Sensitive = true;
     }
     else
     {
         oldPassPhrase.Sensitive = newPassPhrase.Sensitive = retypePassPhrase.Sensitive = recoveryAgentCombo.Sensitive = savePassPhrase.Sensitive = false;
     }
 }
Exemple #7
0
        /// <summary>
        /// Update the User Interface
        /// </summary>
        private void UpdateUI()
        {
            DomainItem domainItem = (DomainItem)this.DomainComboBox.SelectedItem;

            if ((ifWebService.GetSecurityPolicy(domainItem.ID) != 0) && (simiasWebService.IsPassPhraseSet(domainItem.ID)))
            {
                this.filePath.Enabled = this.BrowseButton.Enabled = true;
            }
            else
            {
                this.filePath.Enabled = this.BrowseButton.Enabled = false;
            }
        }
Exemple #8
0
        /// <summary>
        /// Event Handler for Domain Changed event
        /// </summary>
        private void OnDomainChangedEvent(System.Object o, EventArgs args)
        {
            int SecurityPolicy = ifws.GetSecurityPolicy(this.DomainID);

            ChangeStatus(SecurityPolicy);
        }
Exemple #9
0
        /// <summary>
        /// Create More Options
        /// </summary>
        /// <param name="defaultDomainID">Default Domain ID</param>
        /// <returns>Widget</returns>
        private Widget CreateMoreOptionsExpander(string defaultDomainID)
        {
            optionsExpander            = new Expander(Util.GS("More options"));
            optionsExpander.Activated += new EventHandler(OnOptionsExpanded);
            optionsExpander.Activate();

            Table optionsTable = new Table(2, 3, false);

            optionsExpander.Add(optionsTable);

            optionsTable.ColumnSpacing = 10;
            optionsTable.RowSpacing    = 10;
            optionsTable.SetColSpacing(0, 30);


            Label l = new Label(Util.GS("iFolder account"));

            l.Xalign = 0;
            optionsTable.Attach(l, 1, 2, 0, 1,
                                AttachOptions.Shrink | AttachOptions.Fill, 0, 0, 0);

            //	Encryption = new CheckButton(Util.GS("Encrypt the iFolder"));
            Encryption = new RadioButton(Util.GS("Passphrase Encryption"));
            optionsTable.Attach(Encryption, 2, 3, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, 0, 0, 0);

            //	SSL = new CheckButton(Util.GS("Secure Data Transfer"));
            Regular = new RadioButton(Encryption, Util.GS("Regular"));
            optionsTable.Attach(Regular, 3, 4, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, 0, 0, 0);

            SecureSync = new CheckButton(Util.GS("Secure Sync"));
            optionsTable.Attach(SecureSync, 4, 5, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, 0, 0, 0);

            l        = new Label(Util.GS("Security"));
            l.Xalign = 0;
            optionsTable.Attach(l, 1, 2, 1, 2,
                                AttachOptions.Shrink | AttachOptions.Fill, 0, 0, 0);

            // Set up Domains
            domainComboBox = ComboBox.NewText();
            optionsTable.Attach(domainComboBox, 2, 3, 0, 1,
                                AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);

            int defaultDomain = 0;

            for (int x = 0; x < domains.Length; x++)
            {
                domainComboBox.AppendText(string.Format(domains[x].Name + " - " + domains[x].Host));
                if (defaultDomainID != null)
                {
                    if (defaultDomainID == domains[x].ID)
                    {
                        defaultDomain = x;
                    }
                }
                else
                {
                    defaultDomain = x;
                }
            }

            domainComboBox.Active = defaultDomain;

            int SecurityPolicy = ifws.GetSecurityPolicy(this.DomainID);

            ChangeStatus(SecurityPolicy);

/*
 *                      l = new Label(Util.GS("Description:"));
 *                      l.Xalign = 0;
 *                      optionsTable.Attach(l, 1,2,1,2,
 *                                                              AttachOptions.Shrink | AttachOptions.Fill, 0,0,0);
 *
 *                      descriptionTextView = new TextView();
 *                      descriptionTextView.LeftMargin = 4;
 *                      descriptionTextView.RightMargin = 4;
 *                      descriptionTextView.Editable = true;
 *                      descriptionTextView.CursorVisible = true;
 *                      descriptionTextView.AcceptsTab = false;
 *                      descriptionTextView.WrapMode = WrapMode.WordChar;
 *
 *                      ScrolledWindow sw = new ScrolledWindow();
 *                      sw.ShadowType = ShadowType.EtchedIn;
 *                      sw.Add(descriptionTextView);
 *                      optionsTable.Attach(sw, 2,3,1,2,
 *                                                              AttachOptions.Expand | AttachOptions.Fill, 0,0,0);
 */

            optionsTable.ShowAll();

            return(optionsExpander);
        }
Exemple #10
0
        /// <summary>
        /// Event handler for Domain Login COmpleted
        /// </summary>
        private void OnDomainLoginCompleted(object o, DomainLoginCompletedArgs args)
        {
            if (WaitDialog != null)
            {
                WaitDialog.Hide();
                WaitDialog.Destroy();
                WaitDialog = null;
            }

            Status authStatus = args.AuthenticationStatus;

            if (authStatus != null)
            {
                switch (authStatus.statusCode)
                {
                case StatusCodes.Success:
                case StatusCodes.SuccessInGrace:
                    if (LoginDialog != null)
                    {
                        LoginDialog.Hide();
                        LoginDialog.Destroy();
                        LoginDialog = null;
                    }
                    // Check if any recovery agent present;
                    // if( domainController.GetRAList(args.DomainID) == null)
                    // {
                    // No recovery agent present;
                    //		return;
                    // }
                    ShowClientUpgradeMessageBox();
                    iFolderWebService ifws = DomainController.GetiFolderService();
                    int policy             = ifws.GetSecurityPolicy(args.DomainID);
                    if (policy % 2 == 0)
                    {
                        break;
                    }
                    bool passphraseStatus = simws.IsPassPhraseSet(args.DomainID);
                    if (passphraseStatus == true)
                    {
                        bool rememberOption = simws.GetRememberOption(args.DomainID);
                        if (rememberOption == false)
                        {
                            ShowVerifyDialog(args.DomainID, simws);
                        }
                        else
                        {
                            Debug.PrintLine(" remember Option true. Checking for passphrase existence");
                            string passphrasecheck = simws.GetPassPhrase(args.DomainID);
                            if (passphrasecheck == null || passphrasecheck == "")
                            {
                                Debug.PrintLine("BugBug: Passphrase doesn't exist");
                                ShowVerifyDialog(args.DomainID, simws);
                            }
                        }
                    }
                    else
                    {
                        iFolderWindow.ShowEnterPassPhraseDialog(args.DomainID, simws);
                    }

//						string[] array = domainController.GetRAList( args.DomainID);
                    iFolderData ifdata = iFolderData.GetData();
                    ifdata.Refresh();
                    UpdateWidgetSensitivity();
                    break;

                case StatusCodes.InvalidCertificate:
                    DomainInformation dom = domainController.GetDomain(args.DomainID);
                    if (authStatus.UserName != null)
                    {
                        dom.Host = authStatus.UserName;
                    }
                    byte[] byteArray = simws.GetCertificate(dom.Host);
                    System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);

                    iFolderMsgDialog dialog = new iFolderMsgDialog(
                        null,
                        iFolderMsgDialog.DialogType.Question,
                        iFolderMsgDialog.ButtonSet.YesNo,
                        "",
                        Util.GS("Accept the certificate of this server?"),
                        string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), dom.Host),
                        cert.ToString(true));

                    Gdk.Pixbuf certPixbuf = new Gdk.Pixbuf(Util.ImagesPath("ifolder-application-x-x509-ca-cert_48.png"));
                    if (certPixbuf != null && dialog.Image != null)
                    {
                        dialog.Image.Pixbuf = certPixbuf;
                    }

                    int rc = dialog.Run();
                    dialog.Hide();
                    dialog.Destroy();
                    if (rc == -8)                            // User clicked the Yes button
                    {
                        simws.StoreCertificate(byteArray, dom.Host);
                        LoginDialog.Respond(Gtk.ResponseType.Ok);
                    }
                    else
                    {
                        LoginDialog.Respond(Gtk.ResponseType.Cancel);
                    }
                    break;

                case StatusCodes.UserAlreadyMoved:
                    LoginDialog.Respond(Gtk.ResponseType.Ok);
                    break;

                default:
                    Util.ShowLoginError(topLevelWindow, authStatus.statusCode);

                    if (LoginDialog != null)
                    {
                        LoginDialog.Present();
                    }

                    UpdateDomainStatus(args.DomainID);
                    break;
                }
                //UpdateiFolderWindowOnLoginComplete();
            }
            else
            {
                Util.ShowLoginError(topLevelWindow, StatusCodes.Unknown);

                if (LoginDialog != null)
                {
                    LoginDialog.Present();
                }

                UpdateDomainStatus(args.DomainID);
            }

            iFolderWindow ifwin = Util.GetiFolderWindow();

            ifwin.UpdateServerInfoForSelectedDomain();
            ifwin.UpdateListViewItems();
        }