private async void mimicLogin() { InitializeAPI temp = new InitializeAPI(); try { temp.initGoogleDriveAPI(); await CloudLogin.googleDriveLogin(); temp.initOneDriveAPI(); await CloudLogin.oneDriveLogin(user); GoogleDriveCalls gdc = new GoogleDriveCalls(); OneDriveCalls odc = new OneDriveCalls(); bool goog = await gdc.fetchAllMetaData(metaDataController, "Google Drive"); bool one = await odc.fetchAllMetaData(metaDataController, "One Drive"); } catch (Exception e) { } finally { Models.SupportClasses.TreeNode googleRootnode = metaDataController.getRoot("Google Drive", "googleRoot", "Google Drive"); Models.SupportClasses.TreeNode oneDriveRootnode = metaDataController.getRoot("One Drive", "driveRoot", "One Drive"); hierarchyAdd(googleRootnode); hierarchyAdd(oneDriveRootnode); } }
private async void googleDriveClick(object sender, RoutedEventArgs e) { cloudId = 2; List <string> token = api.initGoogleDriveAPI(); //TODO: try catch var accessToken = token[0]; var refreshToken = token[1]; Console.WriteLine("googledrive token: " + token); if (registerUserCloud(accessToken, cloudId, refreshToken)) { Console.WriteLine("Registration succeeded for Google Drive."); } else { Console.WriteLine("Registration failed for Google Drive."); } CloudLogin.googleDriveLogin(); bool main = false;//check to see if there is a main open MainWindow mainWindow = null; foreach (var wnd in Application.Current.Windows) { if (wnd is MainWindow) { Console.WriteLine("Main or Cloud window open"); mainWindow = (MainWindow)wnd; main = true; } } //does a mainWindow exist? if (main == false) { //only if this was on new guqu account mainWindow = new MainWindow(user); mainWindow.Show(); } InitializeAPI temp = new InitializeAPI(); try { temp.initGoogleDriveAPI(); await CloudLogin.googleDriveLogin(); } catch (Exception ex) { return; } GoogleDriveCalls gdc = new GoogleDriveCalls(); mainWindow.addHierarchy(gdc, "Google Drive", "googleRoot", "Google Drive"); mainWindow.setButtonsClickable(true); this.Close(); }
public OneDriveCallsTests() { api = new InitializeAPI(); api.initOneDriveAPI(); User user = new User(); CloudLogin.oneDriveLogin(user); this.downloadFileAsyncTest1(); }
public GoogleDriveCallsTests() { try { List <string> s = api.initGoogleDriveAPI(); CloudLogin.googleDriveLogin(); gdc = new GoogleDriveCalls(); } catch (Exception e) { } }
void SetAttributeCallback(string message, bool hasError) { if (hasError) { print("Error adding attribute: " + message); } else { print("currently attribute color is null?" + (CloudLoginUser.CurrentUser.GetAttributeValue("Color") == null).ToString()); print("currently attribute color " + CloudLoginUser.CurrentUser.GetAttributeValue("Color")); var item = CloudLogin.GetStoreItems().First(); print("Purchase Store Item: " + item.GetName() + ": " + item.GetCost()); CloudLoginUser.CurrentUser.PurchaseStoreItem(CloudLogin.GetStoreItems().First(), PurchasedItem); } }
// Use this for initialization void Start() { var random = ((int)(Random.value * 10000)).ToString(); userEmail = "tom" + random + "@mundo.com"; username = "******" + random; if (gameToken == "" || gameID == "") { EditorUtility.DisplayDialog("Add ID and Token", "Please add your token and ID, if you do not have one, you can create a free account from cloudlogin.dev", "OK"); throw new Exception("Token and ID Invalid"); } else { Debug.Log("CloudLogin start"); CloudLogin.SetVerboseLogging(true); CloudLogin.SetUpGame(gameID, gameToken, ApplicationSetUp, true); } }
private async void oneDriveClick(object sender, RoutedEventArgs e) { cloudId = 1; api.initOneDriveAPI(); //CloudLogin.oneDriveLogin(user); bool main = false;//check to see if there is a main open MainWindow mainWindow = null; foreach (var wnd in Application.Current.Windows) { if (wnd is MainWindow) { Console.WriteLine("Main or Cloud window open"); mainWindow = (MainWindow)wnd; main = true; } } //does a mainWindow exist? if (main == false) { //only if this was on new guqu account mainWindow = new MainWindow(user); mainWindow.Show(); } InitializeAPI temp = new InitializeAPI(); try { temp.initOneDriveAPI(); await CloudLogin.oneDriveLogin(user); } catch (Exception ex) { return; } OneDriveCalls odc = new OneDriveCalls(); mainWindow.addHierarchy(odc, "One Drive", "driveRoot", "One Drive"); mainWindow.setButtonsClickable(true); this.Close(); }
void ApplicationSetUp(string message, bool hasError) { if (hasError) { print("error setting aplication"); print(message); } else { print("<color=yellow>GAME CONNECTED!!" + CloudLogin.GetGameId() + "</color>"); print("Store Items:"); foreach (CloudLoginStoreItem storeItem in CloudLogin.GetStoreItems()) { print(" " + storeItem.GetName() + ": " + storeItem.GetCost()); } print("*****************************************"); print("*****************************************"); print("Signing Up"); CloudLogin.SignUp(userEmail, "password", "password", username, SignedUp); } }
//[MethodImpl(MethodImplOptions.Synchronized)] //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")] /// <summary> /// Entry Point of Framework /// </summary> /// <param name="form"></param> /// <returns></returns> public ActionResult Index(FormCollection form) { //if (!User.Identity.IsAuthenticated) //{ // // Required to allow javascript redirection through to browser // this.Response.TrySkipIisCustomErrors = true; // this.Response.Status = "401 Unauthorized"; // this.Response.StatusCode = 401; // // note that the following line is .NET 4.5 or later only // // otherwise you have to suppress the return URL etc manually! // this.Response.SuppressFormsAuthenticationRedirect = true; // // If we got this far, something failed //} var url = CloudLogin.IsAllowedToLogin(Request.Url.ToString()); if (!string.IsNullOrEmpty(url)) { return(RedirectPermanent(url)); } VAdvantage.DataBase.DBConn.SetConnectionString();//Init database conection LoginModel model = null; if (User.Identity.IsAuthenticated) { try { //var conf = WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath); // SessionStateSection section = (SessionStateSection) conf.GetSection("system.web/sessionState"); // int timeout = (int) section.Timeout.TotalMinutes; Session.Timeout = 20; // ideal timout } catch { } //AccountController a = new AccountController(); //a.LogOff(); FormsIdentity ident = User.Identity as FormsIdentity; Ctx ctx = null; if (ident != null) { FormsAuthenticationTicket ticket = ident.Ticket; string loginContextString = ticket.UserData;// get login context string from Form Ticket LoginContext lCtx = JsonHelper.Deserialize(loginContextString, typeof(LoginContext)) as LoginContext; IDataReader dr = null; //create class from string string key = ""; if (Session["ctx"] != null) { ctx = Session["ctx"] as Ctx; //Update Old Session MSession session = MSession.Get(ctx, false); if (session != null) { session.Logout(); } key = ctx.GetSecureKey(); //if (Session.Timeout < 2) //{ SessionEventHandler.SessionEnd(ctx); Session.Timeout = 17; //} Session["ctx"] = null; } ctx = new Ctx(lCtx.ctxMap); //cretae new context if (key != "") { ctx.SetSecureKey(key); } Session["ctx"] = ctx; //get login Language object on server var loginLang = ctx.GetAD_Language(); Language l = Language.GetLanguage(ctx.GetAD_Language()); //Language.GetLoginLanguage(); l = VAdvantage.Utility.Env.VerifyLanguage(ctx, l); ctx.SetContext(VAdvantage.Utility.Env.LANGUAGE, l.GetAD_Language()); ctx.SetContext(VAdvantage.Utility.Env.ISRIGHTTOLEFT, VAdvantage.Utility.Env.IsRightToLeft(loginLang) ? "Y" : "N"); new VAdvantage.Login.LoginProcess(ctx).LoadSysConfig(); ViewBag.culture = ctx.GetAD_Language(); ViewBag.direction = ctx.GetIsRightToLeft() ? "rtl" : "ltr"; //Change Authentication model = new LoginModel(); model.Login1Model = new Login1Model(); model.Login2Model = new Login2Model(); model.Login1Model.UserName = User.Identity.Name; model.Login1Model.LoginLanguage = ctx.GetAD_Language(); model.Login2Model.Role = ctx.GetAD_Role_ID().ToString(); model.Login2Model.Client = ctx.GetAD_Client_ID().ToString(); model.Login2Model.Org = ctx.GetAD_Org_ID().ToString(); model.Login2Model.Warehouse = ctx.GetAD_Warehouse_ID().ToString(); var RoleList = new List <KeyNamePair>(); var ClientList = new List <KeyNamePair>(); var OrgList = new List <KeyNamePair>(); var WareHouseList = new List <KeyNamePair>(); LoginHelper.Login(model, out RoleList); //string diableMenu = ctx.GetContext("#DisableMenu"); Helpers.MenuHelper mnuHelper = new Helpers.MenuHelper(ctx); // inilitilize menu class bool disableMenu = MRole.GetDefault(ctx).IsDisableMenu(); ctx.SetIsBasicDB(mnuHelper.GetIsBasicDB()); // If Home page not linked OR home page Linked BUT Menu is not disabled , then show home page. // If Home is linked as well as menu is disabled then don't load Default Home Page Settings if (MRole.GetDefault(ctx).GetHomePage_ID() == 0 || (MRole.GetDefault(ctx).GetHomePage_ID() > 0 && !disableMenu)) { HomeModels hm = new HomeModels(); objHomeHelp = new HomeHelper(); hm = objHomeHelp.getLoginUserInfo(ctx, 32, 32); ViewBag.UserPic = hm.UsrImage; } if (!disableMenu) // if menu is not disabled, only then load menu. { //get current user info ViewBag.Menu = mnuHelper.GetMenuTree(); // create tree Session["barNodes"] = ViewBag.Menu.GetBarNodes(); /* add is session to get it in favourite call */ ViewBag.TreeHtml = mnuHelper.GetMenuTreeUI(ViewBag.Menu.GetRootNode(), @Url.Content("~/")); } ViewBag.disableMenu = disableMenu; mnuHelper.dispose(); // LoginHelper.GetClients(id) ClientList = LoginHelper.GetClients(ctx.GetAD_Role_ID()); // .Add(new KeyNamePair(ctx.GetAD_Client_ID(), ctx.GetAD_Client_Name())); OrgList = LoginHelper.GetOrgs(ctx.GetAD_Role_ID(), ctx.GetAD_User_ID(), ctx.GetAD_Client_ID()); // .Add(new KeyNamePair(ctx.GetAD_Org_ID(), ctx.GetAD_Org_Name())); WareHouseList = LoginHelper.GetWarehouse(ctx.GetAD_Org_ID()); // .Add(new KeyNamePair(ctx.GetAD_Warehouse_ID(), ctx.GetContext("#M_Warehouse_Name"))); ViewBag.RoleList = RoleList; ViewBag.ClientList = ClientList; ViewBag.OrgList = OrgList; ViewBag.WarehouseList = WareHouseList; lock (_lock) // Locked bundle Object and session Creation to handle concurrent requests. { //Cretae new Sessin MSession sessionNew = MSession.Get(ctx, true, GetVisitorIPAddress(true)); var lst = VAdvantage.ModuleBundles.GetStyleBundles(); //Get All Style Bundle foreach (var b in lst) { if (!BundleTable.Bundles.Contains(b)) { BundleTable.Bundles.Add(b); //Add in Mvc Bundle Table } } var lstRTLStyle = VAdvantage.ModuleBundles.GetRTLStyleBundles(); //Get All Script Bundle foreach (var b in lstRTLStyle) { if (!BundleTable.Bundles.Contains(b)) { BundleTable.Bundles.Add(b); //Add in Mvc Bundlw Table } } var lstScript = VAdvantage.ModuleBundles.GetScriptBundles(); //Get All Script Bundle foreach (var b in lstScript) { if (!BundleTable.Bundles.Contains(b)) { BundleTable.Bundles.Add(b); //Add in Mvc Bundlw Table } } ViewBag.LibSuffix = ""; ViewBag.FrameSuffix = "_v1"; int libFound = 0; foreach (Bundle b in BundleTable.Bundles) { if (b.Path.Contains("ViennaBase") && b.Path.Contains("_v") && ViewBag.LibSuffix == "") { ViewBag.LibSuffix = Util.GetValueOfInt(ctx.GetContext("#FRONTEND_LIB_VERSION")) > 2 ? "_v3" : "_v2"; libFound++; } if (b.Path.Contains("VIS") && b.Path.Contains("_v")) { ViewBag.FrameSuffix = Util.GetValueOfInt(ctx.GetContext("#FRAMEWORK_VERSION")) > 1 ? "_v2" : "_v1"; libFound++; } if (libFound >= 2) { break; } } //check system setting// set to skipped lib } } } else { model = new LoginModel(); model.Login1Model = new Login1Model(); //model.Login1Model.UserName = "******"; //model.Login1Model.Password = "******"; model.Login1Model.LoginLanguage = "en_US"; model.Login2Model = new Login2Model(); ViewBag.RoleList = new List <KeyNamePair>(); ViewBag.OrgList = new List <KeyNamePair>(); ViewBag.WarehouseList = new List <KeyNamePair>(); ViewBag.ClientList = new List <KeyNamePair>(); ViewBag.Languages = Language.GetLanguages(); Session["ctx"] = null; ViewBag.direction = "ltr"; ViewBag.LibSuffix = ""; foreach (Bundle b in BundleTable.Bundles) { if (b.Path.Contains("ViennaBase") && b.Path.Contains("_v")) { ViewBag.LibSuffix = "_v2"; break; } } } return(View(model)); }
public CloudConnector(CloudLogin credentials) : this() { username = credentials.Username; password = credentials.Password; }