예제 #1
0
        /// <summary>
        /// Event Handler for Login Dialog Response event
        /// </summary>
        private void OnLoginDialogResponse(object o, ResponseArgs args)
        {
            switch (args.ResponseId)
            {
            case Gtk.ResponseType.Ok:
                DomainInformation dom = domainController.GetDomain(LoginDialog.Domain);

                if (WaitDialog != null)
                {
                    WaitDialog.Hide();
                    WaitDialog.Destroy();
                    WaitDialog = null;
                }

                VBox  vbox            = new VBox(false, 0);
                Image connectingImage = new Image(Util.ImagesPath("ifolder-add-account48.png"));
                vbox.PackStart(connectingImage, false, false, 0);

                WaitDialog =
                    new iFolderWaitDialog(
                        topLevelWindow,
                        vbox,
                        iFolderWaitDialog.ButtonSet.None,
                        Util.GS("Connecting..."),
                        Util.GS("Connecting..."),
                        Util.GS("Please wait while your iFolder account is connecting."));

                if (!Util.RegisterModalWindow(WaitDialog))
                {
                    try
                    {
                        Util.CurrentModalWindow.Present();
                    }
                    catch {}
                    WaitDialog.Destroy();
                    return;
                }
                WaitDialog.Show();

                DomainLoginThread domainLoginThread =
                    new DomainLoginThread(domainController);

                domainLoginThread.Completed +=
                    new DomainLoginCompletedHandler(OnDomainLoginCompleted);

                domainLoginThread.Login(dom.ID, LoginDialog.Password, LoginDialog.ShouldSavePassword);

                break;

            case Gtk.ResponseType.Cancel:
            case Gtk.ResponseType.DeleteEvent:
                LoginDialog.Hide();
                LoginDialog.Destroy();
                LoginDialog = null;
                break;
            }
        }
예제 #2
0
 public AddAccountWizard(SimiasWebService simws)
     : base(WindowType.Toplevel)
 {
     this.Title = Util.GS("iFolder Account Assistant");
        this.Resizable = false;
        this.Modal = true;
        this.WindowPosition = Gtk.WindowPosition.Center;
        this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder24.png"));
        this.simws = simws;
        domainController = DomainController.GetDomainController();
        ConnectedDomain = null;
        WaitDialog = null;
        this.Add(CreateWidgets());
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
        SetUpButtons();
 }
예제 #3
0
 private void OnLoginDialogResponse(object o, ResponseArgs args)
 {
     switch (args.ResponseId)
        {
     case Gtk.ResponseType.Ok:
      DomainInformation dom = domainController.GetDomain(LoginDialog.Domain);
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      VBox vbox = new VBox(false, 0);
      Image connectingImage = new Image(Util.ImagesPath("ifolder-add-account48.png"));
      vbox.PackStart(connectingImage, false, false, 0);
      WaitDialog =
       new iFolderWaitDialog(
        topLevelWindow,
        vbox,
        iFolderWaitDialog.ButtonSet.None,
        Util.GS("Connecting..."),
        Util.GS("Connecting..."),
        Util.GS("Please wait while your iFolder account is connecting."));
      if (!Util.RegisterModalWindow(WaitDialog))
      {
       try
       {
        Util.CurrentModalWindow.Present();
       }
       catch{}
       WaitDialog.Destroy();
       return;
      }
      WaitDialog.Show();
      DomainLoginThread domainLoginThread =
       new DomainLoginThread(domainController);
      domainLoginThread.Completed +=
       new DomainLoginCompletedHandler(OnDomainLoginCompleted);
      domainLoginThread.Login(dom.ID, LoginDialog.Password, LoginDialog.ShouldSavePassword);
      break;
     case Gtk.ResponseType.Cancel:
     case Gtk.ResponseType.DeleteEvent:
      LoginDialog.Hide();
      LoginDialog.Destroy();
      LoginDialog = null;
      break;
        }
 }
예제 #4
0
 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;
       }
       int result;
       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);
       }
       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 = Util.LoadIcon("gnome-mime-application-x-x509-ca-cert", 48);
       if (certPixbuf != null && dialog.Image != null)
        dialog.Image.Pixbuf = certPixbuf;
       int rc = dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       if(rc == -8)
       {
        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;
     }
        }
        else
        {
     Util.ShowLoginError(topLevelWindow, StatusCodes.Unknown);
     if (LoginDialog != null)
      LoginDialog.Present();
     UpdateDomainStatus(args.DomainID);
        }
        iFolderWindow ifwin = Util.GetiFolderWindow();
        ifwin.UpdateServerInfoForSelectedDomain();
        ifwin.UpdateListViewItems();
 }
예제 #5
0
 private bool OnConnectClicked(object o, EventArgs args)
 {
     string serverName = ServerNameEntry.Text.Trim();
        string userName = UserNameEntry.Text.Trim();
        string password = PasswordEntry.Text;
        if (WaitDialog == null)
        {
     VBox vbox = new VBox(false, 0);
     Image connectingImage = new Image(Util.ImagesPath("ifolder48.png"));
     vbox.PackStart(connectingImage, false, false, 0);
     Label l = new Label("<span size=\"xx-small\">FIXME: This will be\nreplaced with an\nanimated image</span>");
     vbox.PackStart(l);
     l.UseMarkup = true;
     l.LineWrap = true;
     WaitDialog =
      new iFolderWaitDialog(
       this,
       vbox,
       iFolderWaitDialog.ButtonSet.None,
       Util.GS("Connecting..."),
       Util.GS("Connecting..."),
       Util.GS("Please wait while your iFolder account is connecting."));
     WaitDialog.Show();
        }
        AddDomainThread addDomainThread =
     new AddDomainThread(
      domainController,
      serverName,
      userName,
      password,
      RememberPasswordCheckButton.Active,
      DefaultServerCheckButton.Active);
        addDomainThread.Completed +=
     new EventHandler(OnAddDomainCompleted);
        addDomainThread.AddDomain();
        return false;
 }
예제 #6
0
 private void OnAddDomainCompleted(object o, EventArgs args)
 {
     AddDomainThread addDomainThread = (AddDomainThread)o;
        DomainInformation dom = addDomainThread.Domain;
        Exception e = addDomainThread.Exception;
        if (dom == null && e != null)
        {
     if (e is DomainAccountAlreadyExistsException)
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("An account already exists"),
       Util.GS("An account for this server already exists on the local machine.  Only one account per server is allowed."));
      dg.Run();
      dg.Hide();
      dg.Destroy();
     }
     else
     {
      iFolderMsgDialog dg2 = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("Unable to connect to the iFolder Server"),
       Util.GS("An error was encountered while connecting to the iFolder server.  Please verify the information entered and try again.  If the problem persists, please contact your network administrator."),
       Util.GS(e.Message));
      dg2.Run();
      dg2.Hide();
      dg2.Destroy();
     }
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
        }
        if (dom == null)
        {
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
     return;
        }
        switch(dom.StatusCode)
        {
     case StatusCodes.InvalidCertificate:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      string serverName = addDomainThread.ServerName;
      byte[] byteArray = simws.GetCertificate(serverName);
      System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
      iFolderMsgDialog dialog = new iFolderMsgDialog(
       this,
       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."), serverName),
       cert.ToString(true));
      Gdk.Pixbuf certPixbuf = Util.LoadIcon("gnome-mime-application-x-x509-ca-cert", 48);
      if (certPixbuf != null && dialog.Image != null)
       dialog.Image.Pixbuf = certPixbuf;
      int rc = dialog.Run();
      dialog.Hide();
      dialog.Destroy();
      if(rc == -8)
      {
       simws.StoreCertificate(byteArray, serverName);
       OnConnectClicked(o, args);
      }
      break;
     case StatusCodes.Success:
     case StatusCodes.SuccessInGrace:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      string password = addDomainThread.Password;
      bool bRememberPassword = addDomainThread.RememberPassword;
      Status authStatus =
       domainController.AuthenticateDomain(
        dom.ID, password, bRememberPassword);
      if (authStatus != null)
      {
       if (authStatus.statusCode == StatusCodes.Success ||
        authStatus.statusCode == StatusCodes.SuccessInGrace)
       {
        ConnectedDomain = dom;
        AccountDruid.Page = SummaryPage;
        break;
       }
       else
       {
        Util.ShowLoginError(this, authStatus.statusCode);
       }
      }
      else
      {
       Util.ShowLoginError(this, StatusCodes.Unknown);
      }
      break;
     default:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      Util.ShowLoginError(this, dom.StatusCode);
      break;
        }
 }
예제 #7
0
 private void OnAddDomainCompleted(object o, EventArgs args)
 {
     AddDomainThread addDomainThread = (AddDomainThread)o;
        DomainInformation dom = addDomainThread.Domain;
        string serverName = addDomainThread.ServerName;
        Exception e = addDomainThread.Exception;
        Gdk.Pixbuf certPixbuf1 = new Gdk.Pixbuf(Util.ImagesPath("ifolder-application-x-x509-ca-cert_48.png"));
        if (dom == null && e != null)
        {
     if (e is DomainAccountAlreadyExistsException)
     {
      iFolderMsgDialog dg = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("An account already exists"),
       Util.GS("An account for this server already exists on the local machine.  Only one account per server is allowed."));
      dg.Run();
      dg.Hide();
      dg.Destroy();
     }
     else
     {
      iFolderMsgDialog dg2 = new iFolderMsgDialog(
       this,
       iFolderMsgDialog.DialogType.Error,
       iFolderMsgDialog.ButtonSet.Ok,
       "",
       Util.GS("Unable to connect to the iFolder Server"),
       Util.GS("An error was encountered while connecting to the iFolder server.  Please verify the information entered and try again.  If the problem persists, please contact your network administrator."),
       Util.GS(String.Format("Msg {0} \n Stack {1}", e.Message, e.StackTrace)));
      dg2.Run();
      dg2.Hide();
      dg2.Destroy();
     }
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
        }
        if (dom == null)
        {
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
     return;
        }
        switch(dom.StatusCode)
        {
     case StatusCodes.InvalidCertificate:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      serverName = (dom.HostUrl != null) ? dom.HostUrl : addDomainThread.ServerName;
      CertificateProblem certprob;
      byte[] byteArray = simws.GetCertificate2(serverName, out certprob);
      System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
      if(CertPolicy.CertificateProblem.CertEXPIRED.Equals(certprob))
      {
       iFolderMsgDialog dialog1 = new iFolderMsgDialog(
        this,
        iFolderMsgDialog.DialogType.Question,
        iFolderMsgDialog.ButtonSet.YesNo,
        Util.GS("Unable to Verify Identity"),
        Util.GS("Expired!"),
        string.Format(Util.GS("Certificate Expired! for \"{0}\" iFolder server.  You should examine this server's identity certificate carefully.Do you still want to continue?"), serverName),
        cert.ToString(true));
       if (certPixbuf1 != null && dialog1.Image != null)
        dialog1.Image.Pixbuf = certPixbuf1;
       int rc1 = dialog1.Run();
       dialog1.Hide();
       dialog1.Destroy();
       if(rc1 == 8)
       {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Question,
     iFolderMsgDialog.ButtonSet.YesNo,
     Util.GS("Unable to Verify Identity"),
     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."), serverName),
     cert.ToString(true));
        if (certPixbuf1 != null && dialog.Image != null)
     dialog.Image.Pixbuf = certPixbuf1;
        int rc = dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        if(rc == -8)
        {
     if( !(serverName.ToLower()).StartsWith(Uri.UriSchemeHttp))
     {
      serverName = (new Uri( Uri.UriSchemeHttps + Uri.SchemeDelimiter + serverName.TrimEnd( new char[] {'/'}))).ToString();
     }
     else
     {
      UriBuilder ub = new UriBuilder(serverName);
         ub.Scheme = Uri.UriSchemeHttps;
      serverName = ub.ToString();
     }
     ServerNameEntry.Text = string.Copy(serverName);
     simws.StoreCertificate(byteArray, serverName);
     CertAcceptedCond1 = true;
     ServersForCertStore.Add(serverName);
     OnConnectClicked(o, args);
        }
        else
        {
     CertAcceptedCond1 = false;
     simws.RemoveCertFromTable(serverName);
        }
       }
      }
      else
      {
        iFolderMsgDialog dialog = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Question,
     iFolderMsgDialog.ButtonSet.YesNo,
     Util.GS("Unable to Verify Identity"),
     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."), serverName),
     cert.ToString(true));
        if (certPixbuf1 != null && dialog.Image != null)
     dialog.Image.Pixbuf = certPixbuf1;
        int rc = dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        if(rc == -8)
        {
     if( !(serverName.ToLower()).StartsWith(Uri.UriSchemeHttp))
     {
      serverName = (new Uri( Uri.UriSchemeHttps + Uri.SchemeDelimiter + serverName.TrimEnd( new char[] {'/'}))).ToString();
     }
     else
     {
      UriBuilder ub = new UriBuilder(serverName);
         ub.Scheme = Uri.UriSchemeHttps;
      serverName = ub.ToString();
     }
     ServerNameEntry.Text = string.Copy(serverName);
     simws.StoreCertificate(byteArray, serverName);
     CertAcceptedCond1 = true;
     ServersForCertStore.Add(serverName);
     OnConnectClicked(o, args);
        }
        else
        {
     CertAcceptedCond1 = false;
     simws.RemoveCertFromTable(serverName);
        }
      }
      break;
     case StatusCodes.Success:
     case StatusCodes.SuccessInGrace:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      string password = addDomainThread.Password;
      bool bRememberPassword = addDomainThread.RememberPassword;
      Status authStatus =
       domainController.AuthenticateDomain(
        dom.ID, password, bRememberPassword);
      if (authStatus != null)
      {
       if (authStatus.statusCode == StatusCodes.Success ||
        authStatus.statusCode == StatusCodes.SuccessInGrace)
       {
        ConnectedDomain = dom;
        if(ServersForCertStore.Count > 1 )
        {
     string serverKey = ServersForCertStore[ServersForCertStore.Count - 2] as string;
     UriBuilder TempServerUri = new UriBuilder(serverKey);
     {
      simws.RemoveCertFromTable(TempServerUri.Host);
     }
        }
        ServersForCertStore.Clear();
        iFolderWebService ifws = DomainController.GetiFolderService();
        int policy = ifws.GetSecurityPolicy(dom.ID);
        if( policy % 2 ==0)
        {
     AccountDruid.Page = SummaryPage;
     AccountDruid.Page = DefaultiFolderPage;
        }
        else
        {
     AccountDruid.Page = RAPage;
     ForwardButton.Sensitive = false;
     AccountDruid.CancelButton.Sensitive = false;
        }
        break;
       }
       else
       {
        Debug.PrintLine("Error while authenticating");
        Util.ShowLoginError(this, authStatus.statusCode);
       }
      }
      else
      {
       Util.ShowLoginError(this, StatusCodes.Unknown);
      }
      if(dom.ID != null)
      {
      }
      break;
     default:
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      Util.ShowLoginError(this, dom.StatusCode);
      break;
        }
 }
예제 #8
0
 private bool OnConnectClicked(object o, EventArgs args)
 {
     string serverName = ServerNameEntry.Text.Trim();
        string userName = UserNameEntry.Text.Trim();
        string password = PasswordEntry.Text;
        if (WaitDialog == null)
        {
     VBox vbox = new VBox(false, 0);
     Image connectingImage = new Image(Util.ImagesPath("ifolder-add-account48.png"));
     vbox.PackStart(connectingImage, false, false, 0);
     WaitDialog =
      new iFolderWaitDialog(
       this,
       vbox,
       iFolderWaitDialog.ButtonSet.None,
       Util.GS("Connecting..."),
       Util.GS("Connecting..."),
       Util.GS("Please wait while your iFolder account is connecting."));
     WaitDialog.Show();
        }
        AddDomainThread addDomainThread =
     new AddDomainThread(
      domainController,
      serverName,
      userName,
      password,
      RememberPasswordCheckButton.Active,
      DefaultServerCheckButton.Active);
        addDomainThread.Completed +=
     new EventHandler(OnAddDomainCompleted);
        addDomainThread.AddDomain();
        return false;
 }
예제 #9
0
 private void OnDomainLoginCompleted(object o, EventArgs args)
 {
     Console.WriteLine("PrefsAccountPage.OnDomainLoginCompleted");
        if (WaitDialog != null)
        {
     WaitDialog.Hide();
     WaitDialog.Destroy();
     WaitDialog = null;
        }
        DomainLoginThread domainLoginThread = (DomainLoginThread)o;
        Status authStatus = domainLoginThread.AuthenticationStatus;
        if (authStatus != null)
        {
     if (authStatus.statusCode == StatusCodes.Success ||
      authStatus.statusCode == StatusCodes.SuccessInGrace)
     {
      UpdateWidgetSensitivity();
     }
     else
     {
      Util.ShowLoginError(topLevelWindow, authStatus.statusCode);
      UpdateDomainStatus(domainLoginThread.DomainID);
     }
        }
        else
        {
     Util.ShowLoginError(topLevelWindow, StatusCodes.Unknown);
     UpdateDomainStatus(domainLoginThread.DomainID);
        }
 }
예제 #10
0
 private void LoginDomain(DomainInformation dom, TreeIter iter)
 {
     try
        {
     bool bSavePassword = false;
     string password = domainController.GetDomainPassword(dom.ID);
     if (password != null)
      bSavePassword = true;
     else
     {
      iFolderLoginDialog dialog =
       new iFolderLoginDialog(
        dom.ID, dom.Name, dom.MemberName);
      int rc = dialog.Run();
      dialog.Hide();
      if (rc == (int)ResponseType.Ok)
      {
       password = dialog.Password;
       bSavePassword = dialog.ShouldSavePassword;
      }
      else
      {
       dialog.Destroy();
       return;
      }
      dialog.Destroy();
     }
     if (WaitDialog != null)
     {
      WaitDialog.Hide();
      WaitDialog.Destroy();
      WaitDialog = null;
     }
     VBox vbox = new VBox(false, 0);
     Image connectingImage = new Image(Util.ImagesPath("ifolder48.png"));
     vbox.PackStart(connectingImage, false, false, 0);
     Label l = new Label("<span size=\"xx-small\">FIXME: This will be\nreplaced with an\nanimated image</span>");
     vbox.PackStart(l);
     l.UseMarkup = true;
     l.LineWrap = true;
     WaitDialog =
      new iFolderWaitDialog(
       topLevelWindow,
       vbox,
       iFolderWaitDialog.ButtonSet.None,
       Util.GS("Connecting..."),
       Util.GS("Connecting..."),
       Util.GS("Please wait while your iFolder account is connecting."));
     WaitDialog.Show();
     DomainLoginThread domainLoginThread =
      new DomainLoginThread(
       domainController, dom.ID, password, bSavePassword);
     domainLoginThread.Completed +=
      new EventHandler(OnDomainLoginCompleted);
     domainLoginThread.Login();
        }
        catch
        {
     Util.ShowLoginError(topLevelWindow, StatusCodes.Unknown);
     UpdateDomainStatus(dom.ID);
        }
 }
예제 #11
0
 public KeyRecoveryWizard(SimiasWebService simws,iFolderWebService ifws)
     : base(Gtk.WindowType.Toplevel)
 {
     this.Title = Util.GS("Passphrase Recovery Wizard");
      WaitDialog = null;
          this.Resizable = false;
             this.Modal = true;
             this.WindowPosition = Gtk.WindowPosition.Center;
      this.simws=simws;
      this.ifws=ifws;
      this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder16.png"));
             this.Add(CreateWidgets());
             ControlKeyPressed = false;
             KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
             KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
             SetUpButtons();
 }
예제 #12
0
 private bool OnEnterPassphrasePageValidated(object obj, EventArgs args)
 {
     bool result = false;
       Status status = null;
       if (this.GdkWindow != null)
        this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
       DomainController domainController = DomainController.GetDomainController();
       if(this.newPassphrase.Text != this.confirmPassphrase.Text)
       {
        iFolderMsgDialog dialog = new iFolderMsgDialog(null,
      iFolderMsgDialog.DialogType.Error,
      iFolderMsgDialog.ButtonSet.None,
      Util.GS("Passphrase reset failed"),
      Util.GS("The values in the new and confirm passphrase fields do not match"),
      Util.GS(""));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
        return false;
       }
       DomainInformation domainInfo = (DomainInformation)this.simws.GetDomainInformation(this.selectedDomain);
       try{
        status = this.simws.LogoutFromRemoteDomain(domainInfo.ID);
        if (status.statusCode == StatusCodes.Success)
        {
     status = this.simws.LoginToRemoteDomain(domainInfo.ID, this.password.Text);
     if(status.statusCode != StatusCodes.Success)
     {
      iFolderMsgDialog dialog = new iFolderMsgDialog(null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,
        Util.GS("Passphrase reset failed"),
        Util.GS("Unable to authenticate to the domain.You have been logged out of the account.Please login and try again"),
        Util.GS(""));
      int rc = dialog.Run();
      dialog.Hide();
      dialog.Destroy();
      dialog = null;
      domainController.LogoutDomain(domainInfo.ID);
      if ((ResponseType)rc == ResponseType.Ok)
      {
       CloseDialog();
       ShowNextWizard();
      }
      return false;
     }
     result = true;
        }
       }
       catch(Exception)
       {
        iFolderMsgDialog dialog = new iFolderMsgDialog(null,
      iFolderMsgDialog.DialogType.Error,
      iFolderMsgDialog.ButtonSet.None,
      Util.GS("Passphrase reset failed"),
      Util.GS("Unable to authenticate to the domain.You have been logged out of the account.Please login and try again"),
      Util.GS(""));
        dialog.Run();
        dialog.Hide();
        dialog.Destroy();
        dialog = null;
        domainController.LogoutDomain(domainInfo.ID);
        return false;
       }
       if(result)
       {
        string memberUID = domainInfo.MemberUserID;
        try
        {
     this.simws.ExportRecoverImport(domainInfo.ID, memberUID, this.newPassphrase.Text);
     this.simws.StorePassPhrase(domainInfo.ID,
       this.newPassphrase.Text,
       CredentialType.Basic,
       this.simws.GetRememberOption(domainInfo.ID));
     KeyRecoveryDruid.Page = FinishPage;
        }
        catch(Exception)
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,Util.GS("Passphrase reset failed"),
        Util.GS("You have been logged out of the account.Please login and try again."),
        Util.GS(""));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     dialog = null;
     return false;
        }
        if (WaitDialog != null)
        {
        Console.WriteLine("Hiding wait dialog");
     WaitDialog.Hide();
     WaitDialog.Destroy();
     WaitDialog = null;
        }
       }
       if(this.GdkWindow != null)
        this.GdkWindow.Cursor = null;
       return result;
 }
예제 #13
0
 private bool OnMigrateClicked(object o, EventArgs args)
 {
     if (WaitDialog == null)
        {
     Console.WriteLine("Inside calling wait dialog");
     VBox vbox = new VBox(false, 0);
     Image connectingImage = new Image(Util.ImagesPath("ifolder-add-account48.png"));
     vbox.PackStart(connectingImage, false, false, 0);
     Debug.PrintLine("Before creating WaitDialog instance");
     WaitDialog =
      new iFolderWaitDialog(
       this,
       vbox,
       iFolderWaitDialog.ButtonSet.None,
       Util.GS("Migrating..."),
       Util.GS("Migrating..."),
       Util.GS("Please wait while your iFolder is being migrated"));
     WaitDialog.Show();
     Console.WriteLine(" Showing wait dialog:");
        }
        bool status = DoMigrate();
        if(WaitDialog != null)
        {
     Debug.PrintLine("Killing the wait dialog");
     WaitDialog.Hide();
     WaitDialog.Destroy();
     WaitDialog =null;
        }
        return status;
 }
예제 #14
0
 public MigrationWizard(string User, string path, iFolderWebService ifws, SimiasWebService simws, MigrationWindow page, bool encrypted)
     : base(WindowType.Toplevel)
 {
     this.Title = Util.GS("iFolder Migration Assistant");
        this.Resizable = false;
        this.WindowPosition = Gtk.WindowPosition.Center;
        this.location = path;
        prevLocation = "";
        this.ifdata = iFolderData.GetData();
        this.ifws = ifws;
        this.simws = simws;
        this.Uname = User;
        this.page = page;
        this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder16.png"));
        this.alreadyEncrypted = encrypted;
        domainController = DomainController.GetDomainController();
        WaitDialog = null;
        this.Add(CreateWidgets());
        ControlKeyPressed = false;
        KeyPressEvent += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent += new KeyReleaseEventHandler(KeyReleaseHandler);
        SetUpButtons();
 }
예제 #15
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();
        }