public async Task <User> LogIn(string email, string password) { var parseUser = await ParseUser.LogInAsync(email, password) .ContinueWith(t => { if (t.IsFaulted) { var handled = ParseErrorHandler.HandleParseError(t.Exception.InnerException as ParseException); if (!handled) { throw t.Exception.InnerException; } } _notificationCenter.Send(NotificationKeys.CurrentUserChanged, _currentUser); return(t.Result); }); await AssociateInstallationWithUser(); return(new User { Id = parseUser.ObjectId, Fullname = parseUser["fullname"] as string, Email = parseUser.Username, }); }
public Task TestLogIn() { IObjectState state = new MutableObjectState { ServerData = new Dictionary <string, object>() { { "sessionToken", "llaKcolnu" }, { "username", "ihave" }, { "password", "adream" } } }; IObjectState newState = new MutableObjectState { ObjectId = "some0neTol4v4" }; var mockController = new Mock <IParseUserController>(); mockController.Setup(obj => obj.LogInAsync("ihave", "adream", It.IsAny <CancellationToken>())).Returns(Task.FromResult(newState)); ParseCorePlugins.Instance.UserController = mockController.Object; return(ParseUser.LogInAsync("ihave", "adream").ContinueWith(t => { Assert.False(t.IsFaulted); Assert.False(t.IsCanceled); mockController.Verify(obj => obj.LogInAsync("ihave", "adream", It.IsAny <CancellationToken>()), Times.Exactly(1)); var user = t.Result; Assert.False(user.IsDirty); Assert.Null(user.Username); Assert.AreEqual("some0neTol4v4", user.ObjectId); })); }
public async Task <UserModel> Login(string username, string password) { UserModel model; try { var user = await ParseUser.LogInAsync(username, password); model = new UserModel() { IsSuccess = true, User = user, Message = "Successful" }; } catch (Exception e) { model = new UserModel() { IsSuccess = false, User = null, Message = e.Message }; } return(model); }
public async void SignInUsingParse(string username, string password) { var coll = await this.users.Get(); if (coll.Contains(new User { Username = username, Password = password })) { await ParseUser.LogInAsync(username, password); var successMessage = new MessageDialog("You successfully signed in!"); await successMessage.ShowAsync(); } else { await this.users.Insert(new User { Username = username, Password = password }); var user = ParseUser.Create <UserParse>(); user = new UserParse { Username = username, Password = password }; await user.SignUpAsync(); } }
public void Login() { string user = loginPanel.loginUsername.text; string password = loginPanel.loginPassword.text; loginPanel.setMode(LoginPanel.Mode.LOADING); GameObject loginPanelObject = loginPanel.gameObject; AddLog("Logging In -- " + user + "\n--------------"); ParseUser.LogInAsync(user, password).ContinueWith(t => { // check for errors if (t.IsFaulted) { Exception ex = t.Exception; bufferedLog.Push(ex.ToString()); } else if (t.IsCanceled) { bufferedLog.Push("operation cancelled"); } else { bufferedLog.Push("[User " + user + " login successful]"); } objectsToEnable.Push(loginPanelObject); }); }
private void Login(string username) { isFirst = false; ParseUser.LogInAsync(username, username).ContinueWith(loginTask => { if (loginTask.IsFaulted || loginTask.IsCanceled) { // The login failed. Debug.Log("ID not found, creating new ID"); SignUp(username); } else { // Login was successful. ParseUser user = loginTask.Result; Debug.Log("Successfully logged in as user " + user.Username); scale_A = user.Get <float>("scale_A"); scale_B = user.Get <float>("scale_B"); scale_X = user.Get <float>("scale_X"); scale_Y = user.Get <float>("scale_Y"); lastV = user.Get <float>("lastV"); } }); }
// Use this for initialization void Start() { ParseUser user; // ParseUser.LogOut(); ParseUser.LogInAsync(nome, pwd).ContinueWith(t => { if (t.IsFaulted || t.IsCanceled) { foreach (var e in t.Exception.InnerExceptions) { ParseException parseException = (ParseException)e; Debug.Log("Error message " + parseException.Message); Debug.Log("Error code: " + parseException.Code); } } else { // Login was successful user = t.Result; Debug.Log(user.Username); user.DeleteAsync(); ParseUser.LogOut(); } }); }
private async void LoginBtn_OnClick(object sender, RoutedEventArgs e) { string username = usernameTextBox.Text.ToLower(); string password = passwordTextBox.Password; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { await App.Notify("Please input a username and a password."); return; } try { VisualStateManager.GoToState(this, "LoadingState", true); await ParseUser.LogInAsync(username, password); await FillUserInfo(); //_timer.Start(); GenerateQrCode(); VisualStateManager.GoToState(this, "QRState", true); //this.Frame.Navigate(typeof(MainPage)); //this.Frame.BackStack.Remove(this.Frame.BackStack.First(x => x.SourcePageType == typeof(LoginPage))); //this.Frame.BackStack.Remove(this.Frame.BackStack.First(x => x.SourcePageType == typeof(LandingPage))); } catch (ParseException ex) { await App.Notify(ex.Message); VisualStateManager.GoToState(this, "LoginState", true); } }
public async Task <User> CreateUser(string username, string pass, string email) { try { var user = new ParseUser() { Username = username, Password = pass, Email = email }; User createdUser = new User() { Username = user.Username }; await user.SignUpAsync(); await ParseUser.LogInAsync(username, pass); ((App)App.Current).AuthenticatedUser = ParseUser.CurrentUser; return(createdUser); } catch (Exception e) { new MessageDialog(e.Message).ShowAsync(); return(null); } }
//public async void LoadFB() //{ // try // { // // Make your browser control visible // ParseUser user = await ParseFacebookUtils.LogInAsync(browser, null); // // Hide your browser control // NavigationService.Navigate(new Uri("/WelcomeScreens/Page2.xaml", UriKind.Relative)); // browser.Visibility = Visibility.Collapsed; // } // catch // { // browser.Visibility = Visibility.Collapsed; // //cancelled? // } //} //private void SaveFilesToIsoStore() //{ // //These files must match what is included in the application package, // //or BinaryStream.Dispose below will throw an exception. // string[] files = { // "readme.htm" //}; // IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication(); // if (false == isoStore.FileExists(files[0])) // { // foreach (string f in files) // { // StreamResourceInfo sr = Application.GetResourceStream(new Uri(f, UriKind.Relative)); // using (BinaryReader br = new BinaryReader(sr.Stream)) // { // byte[] data = br.ReadBytes((int)sr.Stream.Length); // SaveToIsoStore(f, data); // } // } // } //} //private void SaveToIsoStore(string fileName, byte[] data) //{ // string strBaseDir = string.Empty; // string delimStr = "/"; // char[] delimiter = delimStr.ToCharArray(); // string[] dirsPath = fileName.Split(delimiter); // //Get the IsoStore. // IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication(); // //Re-create the directory structure. // for (int i = 0; i < dirsPath.Length - 1; i++) // { // strBaseDir = System.IO.Path.Combine(strBaseDir, dirsPath[i]); // isoStore.CreateDirectory(strBaseDir); // } // //Remove the existing file. // if (isoStore.FileExists(fileName)) // { // isoStore.DeleteFile(fileName); // } // //Write the file. // using (BinaryWriter bw = new BinaryWriter(isoStore.CreateFile(fileName))) // { // bw.Write(data); // bw.Close(); // } //} //private void WebBrowser_OnLoaded(object sender, RoutedEventArgs e) //{ // SaveFilesToIsoStore(); // browser.Navigate(new Uri("readme.htm", UriKind.Relative)); //} private async void buttonSignIn_Click(object sender, RoutedEventArgs e) { //TODO: delete query //var users = await (from user in ParseUser.Query // where user.Get<string>("username") == "totoro" // select user).FindAsync(); var query = ParseUser.Query; IEnumerable <ParseObject> results = await query.FindAsync(); var queryEvent = ParseObject.GetQuery(className: "Event"); queryEvent.OrderByDescending("date"); IEnumerable <ParseObject> resultsEvent = await queryEvent.FindAsync(); try { await ParseUser.LogInAsync(logUserName.Text, logPassword2.Password.ToString()); // Login was successful. NavigationService.Navigate(new Uri("/Overview.xaml", UriKind.Relative)); } catch (Exception) { // The login failed. Check the error to see why. MessageBox.Show("Username ou mot de passe incorect."); } }
IEnumerator Async_LogOut() { //Control_UserInfoPanel_LogIn_EMail.label.text; //Control_UserInfoPanel_LogIn_Passwd.label.text; //Control_UserInfoPanel_LogIn_WarningInfo.text; Task LogInTask = ParseUser.LogInAsync(ParseUser.CurrentUser.Username, Control_UserInfoPanel_LogOutVarify_Passwd.label.text); Debug.Log("[LogOut] LogInAsync: " + ParseUser.CurrentUser.Username + "," + Control_UserInfoPanel_LogOutVarify_Passwd.label.text); while (!LogInTask.IsCompleted) { yield return(null); } Debug.Log("[LogOut] LogIn...Result is ..." + LogInTask.IsCompleted + "," + LogInTask.IsCanceled + "," + LogInTask.IsFaulted); //Control_UserInfoPanel_LogIn_FuncBtn.enabled = true; Control_UserInfoPanel_LogOutVarify_LogOutBtn.gameObject.SetActive(true); if (LogInTask.IsFaulted) { Debug.Log("LogIn Fail"); Control_UserInfoPanel_LogOutVarify_WarningInfo.text = "登出失敗"; Control_UserInfoPanel_LogIn_WarningInfo.text = "Fail!"; } else if (LogInTask.IsCompleted) { LogOutProcess(); } }
public Task <GameUser> Login(string email, string password) { Debug.Log("Logging in.."); return(ParseUser.LogInAsync(email, password) .OnMainThread() .Then(t => Task.FromResult((GameUser)t.Result))); }
private async Task <bool> LogIn() { try { await ParseUser.LogInAsync(tbLoginEmail.Text.ToLower(), tbLoginPassword.Text); ParseUser CurrentUser = ParseUser.CurrentUser; PublicUserData publicUserData = await CurrentUser.Get <PublicUserData>("publicUserData").FetchAsync(); // Email not verified if (!CurrentUser.Get <bool>("emailVerified")) { Session["LoginError"] = "Please check your email to verify your account."; return(false); } // Not tutor else if (!Constants.UserType.IsTutor(publicUserData.UserType)) { Session["LoginError"] = "Only tutors may use the website. If you are a student, then you can open CogniStudy through your mobile device."; return(false); } // Didn't pass registration test else if (CurrentUser.Get <int>("registrationTestScore") < 7) { Session["LoginError"] = "You failed to acheive a sufficient score on the registration test."; return(false); } // Login was successful. else { mPage.PublicUserData = publicUserData; //await mPage.PublicUserData.FetchAsync(); //mPage.Tutor = mPage.PublicUserData.Tutor; //await mPage.Tutor.FetchAsync(); //mPage.PrivateTutorData = mPage.Tutor.PrivateTutorData; //await mPage.PrivateTutorData.FetchAsync(); return(true); } } catch (Exception ex) { // The login failed. Check the error to see why. string s = ex.ToString(); Console.WriteLine(s); if (ex.Message.Contains("invalid login parameters")) { Session["LoginError"] = "Username and/or password is incorrect."; return(false); } else { Session["LoginError"] = "There was an unexpected problem with your login. Please try again."; return(false); } } }
IEnumerator Async_LogIn() { //Control_UserInfoPanel_LogIn_EMail.label.text; //Control_UserInfoPanel_LogIn_Passwd.label.text; //Control_UserInfoPanel_LogIn_WarningInfo.text; Debug.Log("LogInAsync: " + Control_UserInfoPanel_LogIn_EMail.label.text + "," + Control_UserInfoPanel_LogIn_Passwd.label.text); string str_emal = Control_UserInfoPanel_LogIn_EMail.label.text; string str_password = (string)Control_UserInfoPanel_LogIn_Passwd.label.text; Debug.Log("LogInAsync: convert-1"); Task AsyncLogIn = ParseUser.LogInAsync(str_emal, str_password); while (!AsyncLogIn.IsCompleted) { yield return(null); } Control_UserInfoPanel_LogIn_FuncBtn.enabled = true; if (AsyncLogIn.IsFaulted || AsyncLogIn.IsCanceled) { Debug.Log("LogIn Fail"); Control_UserInfoPanel_LogIn_WarningInfo.text = "請檢查帳號密碼"; } else { Debug.Log("LogIn Success"); Control_UserInfoPanel_LogIn_WarningInfo.text = ""; CheckExistUser(); } // // str_emal , str_password // ParseUser.LogInAsync(str_emal , str_password ). // ContinueWith(t => // { // if (t.IsFaulted || t.IsCanceled) // { // Debug.Log("LogIn Fail"); // Control_UserInfoPanel_LogIn_WarningInfo.text="Fail!"; // } // else // { // Debug.Log("LogIn Success"); // Control_UserInfoPanel_LogIn_WarningInfo.text="Success!"; // CheckExistUser(); // } // } // ); }
private async void Button_Click(object sender, RoutedEventArgs n) { try { await ParseUser.LogInAsync("buckd", "12345"); } catch (Exception e) { // The login failed. Check the error to see why. } }
public async Task <Boolean> Login(string username, string password) { try{ await ParseUser.LogInAsync(username, password); return(true); } catch (Exception e) { Console.WriteLine("Login Failed: " + e.Message); return(false); } }
private async void UserLogIn(string username, string password) { try { await ParseUser.LogInAsync(username, password); } catch (Exception e) { MessageBox(App.STATE.Activity, "Log In Error", e.Message); } }
IEnumerator UpdateUser() { LoadAlert.Instance.StartLoad("Updating User Account...", null, -1); ParseUser.CurrentUser.Password = PasswordField.text; User.CurrentUser.Name = NameField.text; Task task = ParseUser.CurrentUser.SaveAsync(); while (!task.IsCompleted) { yield return(null); } if (task.IsFaulted) { LoadAlert.Instance.Done(); Debug.Log("couldn't update information:\n" + task.Exception.ToString()); } else { string email = ParseUser.CurrentUser.Email; Task logout = ParseUser.LogOutAsync(); while (!logout.IsCompleted) { yield return(null); } if (logout.IsFaulted) { } else { Task login = ParseUser.LogInAsync(email, PasswordField.text); while (!login.IsCompleted) { yield return(null); } if (login.IsFaulted) { } else { LoadAlert.Instance.Done(); PasswordField.text = ConfirmField.text = NameField.text = ""; Deactivate(); } } } }
public async Task <bool> LoginUserAsync(User user) { try { await ParseUser.LogInAsync(user.Username, user.Password); // Login was successful return(true); } catch (Exception e) { Console.Error.WriteLine(@" ERROR {0}", e.Message); return(false); } }
private async void iniciarSesion(object sender, RoutedEventArgs e) { try { await ParseUser.LogInAsync(user.Text, pass.Password); rootFrame.Navigate(typeof(PrincipalPage)); } catch (Exception exception) { } }
public static async Task <int> Login(User user) { try { await ParseUser.LogInAsync(user.Username, user.Password); } catch (Exception e) { throw e; } return(1); }
public static async Task <string> Login(User user) { try { var parseUser = await ParseUser.LogInAsync(user.Email, user.Password); return(Constants.STR_STATUS_SUCCESS); } catch (Exception e) { return(e.Message); } }
public async Task <bool> Login() { try { await ParseUser.LogInAsync(this.User.Username, this.User.Password); return(true); } catch (Exception ex) { return(false); } }
public async void LogInAsync(string username, string password, Action <bool> callback) { try { await ParseUser.LogInAsync(username, password); callback(true); } catch { // Need to do something here.... callback(false); } }
public void Login(string name, string password) { ParseUser.LogInAsync(name, password).ContinueWith( t => { if (t.IsFaulted || t.IsCanceled) { // The login failed. Check the error to see why. } else { // Login was successful. } }); }
public void LogIn(string username_, string password_, Action onSuccess_, Action onFail_) { ParseUser.LogInAsync(username_, password_).ContinueWith((Task task_) => { if (task_.IsFaulted || task_.IsCanceled) { onFail_(); } else { onSuccess_(); } }); }
private async void goToIniciarSesion(object sender, RoutedEventArgs e) { try { await ParseUser.LogInAsync(user.Text, password.Password); result.Text = "entro"; rootFrame.Navigate(typeof(MainPage)); } catch (Exception) { result.Text = "Usuario y/o Contraseña Incorrectos"; } }
public static async void Login(string email, string password) { try { await ParseUser.LogInAsync(email, password); (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Pages/NewsFeed.xaml?FromLogin=true", UriKind.Relative)); } catch (Exception ex) { // The login failed. Check the error to see why. MessageBox.Show("Error logging in. Please double check your email and password or try again later."); } }
public static async Task <GameUser> LoginAsANewUser() { var email = GetRandomUserEmail(); var u = new GameUser() { Username = email, Email = email, Password = "******", PlayerName = "Test User" }; await u.SignUpAsync(); return((GameUser)await ParseUser.LogInAsync(u.Username, "a")); }
// events private async void EliteExplorer_Load(object sender, EventArgs e) { if (ParseUser.CurrentUser != null) { // do stuff with the user _user = UserMapper.Map(ParseUser.CurrentUser); } else { // show the signup or login screen if (!ConfigurationManager.AppSettings.HasKeys()) { // TODO: Form Popup to signup ConfigurationManager.AppSettings.Add("commander", "The Mule"); } else { // TODO: Login screen popup var login = new Login(); var a = true; while (a) { if (login.ShowDialog() == DialogResult.OK) { var commander = login.UsernameText; var pass = login.PasswordText; try { await ParseUser.LogInAsync(commander, pass); // Login was successful. a = !a; } catch (Exception ex) { // The login failed. Check the error to see why. MessageBox.Show(ex.Message); } } } } } _persistentStore = new ParsePersistentStore(_user); _watcher = new NetLogWatcher(_persistentStore); _watcher.Watcher.Path = @"C:\Users\John Goode\AppData\Local\Frontier_Developments\Products\FORC-FDEV-D-1003\Logs"; // C:\Users\John Goode\AppData\Local\Frontier_Developments\Products\FORC-FDEV-D-1003\Logs _watcher.OnNewPosition += new NetLogWatcherHandler(this.NewPosition); //_watcher.SystemFound += _watcher_SystemFound; _watcher.Start(); }