///<summary> /// Display passphrase dialog ///</summary> ///<param name="path">Path of ifolder</param> ///<param name="domain_id">Id of the domain</param> ///<param name="encrypted">Enctypred or not</param> ///<returns>0 on success else 1</returns> private static int ShowPassPhraseDialog(string path, string domain_id, bool encrypted) { Console.WriteLine(" The corresponding c# file is called"); if (!encrypted) { iFolderWeb newiFolder = ifws.CreateiFolderInDomain(path, domain_id); if (newiFolder != null) { Console.WriteLine("Created iFolder"); return(0); } Console.WriteLine("Error creating iFolder"); return(1); } bool passphraseSet = false; try { passphraseSet = simws.IsPassPhraseSet(domain_id); } catch (Exception ex) { // Unable to create iFolder. Need to login.. } bool passPhraseEntered = false; if (passphraseSet == true) { bool rememberOption = simws.GetRememberOption(domain_id); string passphrasecheck; passphrasecheck = simws.GetPassPhrase(domain_id); if (passphrasecheck == null || passphrasecheck == "") { passPhraseEntered = ShowVerifyDialog(domain_id, simws); } else { passPhraseEntered = true; } } else { passPhraseEntered = ShowEnterPassPhraseDialog(domain_id, simws); } if (passPhraseEntered == true) { iFolderWeb newiFolder = ifws.CreateiFolderInDomainEncr(path, domain_id, !encrypted, "BlowFish", simws.GetPassPhrase(domain_id)); if (newiFolder != null) { return(0); } else { return(1); } } // string[] array = domainController.GetRAList( domain_id); return(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(); }