예제 #1
0
    /*
     * Registiert ein User an der Datenbank.
     */
    public Task signUp(string userName, string password, string email)
    {
        var user = new ParseUser()
        {
            Username = userName,
            Password = password,
            Email    = email
        };

        Username1 = userName;
        Password1 = password;
        Task signUpTask = null;

        try{
            signUpTask = user.SignUpAsync().ContinueWith(t => {
                if (t.IsFaulted || t.IsCanceled)
                {
                    UnityMainThreadDispatcher.Instance().Enqueue(() => OnRegisterFail(userName, t.Exception));
                }
                else
                {
                    UnityMainThreadDispatcher.Instance().Enqueue(() => OnRegisterSuccess(userName));
                }
            });
        }
        catch (System.Exception e) {
        }
        return(signUpTask);
    }
예제 #2
0
        public async Task <ActionResult> Register(User pUser)
        {
            var user = new ParseUser()
            {
                Username = pUser.email,
                Password = pUser.password,
                Email    = pUser.email
            };

            // other fields can be set just like with ParseObject
            user["firstName"]   = pUser.firstName;
            user["lastName"]    = pUser.lastName;
            user["phoneNumber"] = pUser.phoneNumber;

            try
            {
                await user.SignUpAsync();

                // Login was successful.
                Debug.WriteLine("************ Sign Up succesfull *********");
                return(RedirectToAction("Index", "JoinOrCreate"));
            }
            catch (Exception e)
            {
                // The login failed. Check the error to see why.
                Debug.WriteLine("************ error SignUp *********" + e);
                return(RedirectToAction("Index", "login"));
            }
        }
예제 #3
0
        public async void signup(string email, string password, Action signupSuccess, Action signupError)
        {
            var user = new ParseUser()
            {
                Username = email,
                Email    = email,
                Password = password
            };

            try
            {
                await user.SignUpAsync();

                Console.WriteLine("signup done");
                if (ParseUser.CurrentUser != null)
                {
                    Console.WriteLine("Connected as : {0}", ParseUser.CurrentUser.Get <string>("username"));
                    signupSuccess();
                }
                else
                {
                    throw new Exception("Parse Current User null");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Signup did not work : " + e.Message);
                signupError();
            }
        }
예제 #4
0
    private void SignUp(string username, string password, string email, Dictionary <string, string> signUpParams)
    {
        var user = new ParseUser()
        {
            Username = username,
            Password = password,
            Email    = email
        };

        foreach (var kvp in signUpParams)
        {
            user[kvp.Key] = kvp.Value;
        }
        user.SignUpAsync();

        /*	Task signUpTask = user.SignUpAsync();
         *      signUpTask.ContinueWith(
         *      task => {
         *              Debug.Log("Calling cloud function");
         *              ParseCloud.CallFunctionAsync<Dictionary<string,object>>("GetSuggestions", new Dictionary<string, object>()).ContinueWith(
         *              t => {
         *                      var suggestions = t.Result;
         *                      if(suggestions != null) {
         *                              foreach(var kvp in suggestions) {
         *                                      Debug.Log(kvp.Key + " " + kvp.Value);
         *                              }
         *                      }
         *              });
         *      });*/
    }
    public void RegisterUser(string username, string password, Action <bool, string> callback)
    {
        var user = new ParseUser()
        {
            Username = username.ToLower(),
            Password = password,
        };

        user["wins"]  = 0;
        user["loses"] = 0;

        user.SignUpAsync().ContinueWith(task =>
        {
            if (task.Exception != null)
            {
                Debug.Log("Register Exception : " + task.Exception.InnerExceptions[0].Message);
                callback(false, task.Exception.InnerExceptions[0].Message);
            }
            else
            {
                Debug.Log("User Registeration Successful");
                callback(true, "Successfully Registered");
            }
        });
    }
예제 #6
0
    void CreateUser()
    {
        ParseUser.LogOut();
        var user = new ParseUser()
        {
            Username = usuario,
            Password = pwd,
            Email    = email
        };

        // other fields can be set just like with ParseObject
        user["pontuacao"] = (int)scoreInicial;

        user.SignUpAsync().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
            {
                //SignUpAsync(); //DONE
                Debug.Log("Usuário criado com sucesso");
            }
        });

        ParseUser.LogOut();
    }
예제 #7
0
    IEnumerator loginToParse()
    {
        isProgressDone = false;
        status.SetActive(false);
        HUD.SetActive(true);
        button.SetActive(false);
        var user = new ParseUser()
        {
            Username = nameInput.text,
            Password = "******",
            Email    = nameInput.text + "@mail.com"
        };

        user["highScore"] = 0;
        Task signUpTask = user.SignUpAsync();

        signUpTask.ContinueWith(t => {
            if (t.IsFaulted == false || t.IsCanceled == false)
            {
                Debug.Log("signup done");
                isSignupDone = true;
            }
            else
            {
                Debug.Log("signup error");

                isSignupDone = false;
            }
            isProgressDone = true;
        });
        yield return(signUpTask);
    }
예제 #8
0
    IEnumerator DoSignUp(object[] parms)
    {
        var newUser = new ParseUser()
        {
            Username = parms[0].ToString(),
            Email    = parms[1].ToString(),
            Password = parms[2].ToString()
        };

        newUser ["displayName"] = parms [0].ToString();

        var signUpTask = newUser.SignUpAsync();

        while (!signUpTask.IsCompleted)
        {
            yield return(null);
        }
        if (!signUpTask.IsCanceled && !signUpTask.IsFaulted)
        {
            Debug.Log("Succesfully signed up");
            StatusText.text = "Succesfully signed up";
            AppModel.LoginWithUser(newUser);
        }
        else
        {
            StatusText.text = "Something went wrong";
            foreach (var e in signUpTask.Exception.InnerExceptions)
            {
                ParseException parseException = (ParseException)e;
                Debug.Log("Error message " + parseException.Message);
                Debug.Log("Error code: " + parseException.Code);
            }
        }
    }
예제 #9
0
    private void SignUp(string username)
    {
        ParseUser user = new ParseUser()
        {
            Username = username,
            Password = username,
        };

        user.SignUpAsync().ContinueWith(signUpTask =>
        {
            if (signUpTask.IsFaulted || signUpTask.IsCanceled)
            {
                // The signUp failed.
                Debug.Log("Sign up failed. This might be because: " + signUpTask.Exception.Message);
            }
            else
            {
                // signUp was successful.
                Debug.Log("New user registered!");

                user["scale_A"] = 1;
                user["scale_B"] = 1;
                user["scale_X"] = 1;
                user["scale_Y"] = 1;
                user["lastV"]   = 1;
                user.SaveAsync();
            }
        });
    }
예제 #10
0
        public async Task CreateUserAsync(string username, string email, string password, byte[] profilepic)
        {
            if (username != "" && email != "" && password != "" && profilepic != null)
            {
                ParseFile file = new ParseFile("avatar.jpg", profilepic);

                try {
                    await file.SaveAsync();
                } catch (Exception ex) {
                    Console.WriteLine("Error: " + ex.Message);
                }

                var user = new ParseUser()
                {
                    Username = username,
                    Password = password,
                    Email    = email
                };

                user ["ProfilePic"] = file;
                try {
                    await user.SignUpAsync();
                } catch (Exception ex) {
                    Console.WriteLine("Error: " + ex.Message);
                }
            }
        }
예제 #11
0
        public static async Task <string> SignUp(User user)
        {
            var userObject = new ParseUser()
            {
                Username = user.Email,
                Email    = user.Email,
                Password = user.Password
            };

            userObject["Firstname"] = user.Firstname;
            userObject["Lastname"]  = user.Lastname;
            userObject["PhotoURL"]  = user.PhotoURL;

            try
            {
                await userObject.SignUpAsync();

                return(Constants.STR_STATUS_SUCCESS);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                var response = await Login(user);

                return(response);
            }
        }
예제 #12
0
        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);
            }
        }
예제 #13
0
        public Task TestSignUp()
        {
            IObjectState state = new MutableObjectState {
                ServerData = new Dictionary <string, object>()
                {
                    { "sessionToken", "llaKcolnu" },
                    { "username", "ihave" },
                    { "password", "adream" }
                }
            };
            IObjectState newState = new MutableObjectState {
                ObjectId = "some0neTol4v4"
            };
            ParseUser user           = ParseObject.FromState <ParseUser>(state, "_User");
            var       mockController = new Mock <IParseUserController>();

            mockController.Setup(obj => obj.SignUpAsync(It.IsAny <IObjectState>(),
                                                        It.IsAny <IDictionary <string, IParseFieldOperation> >(),
                                                        It.IsAny <CancellationToken>())).Returns(Task.FromResult(newState));
            ParseCorePlugins.Instance.UserController = mockController.Object;

            return(user.SignUpAsync().ContinueWith(t => {
                Assert.False(t.IsFaulted);
                Assert.False(t.IsCanceled);
                mockController.Verify(obj => obj.SignUpAsync(It.IsAny <IObjectState>(),
                                                             It.IsAny <IDictionary <string, IParseFieldOperation> >(),
                                                             It.IsAny <CancellationToken>()), Times.Exactly(1));
                Assert.False(user.IsDirty);
                Assert.AreEqual("ihave", user.Username);
                Assert.False(user.State.ContainsKey("password"));
                Assert.AreEqual("some0neTol4v4", user.ObjectId);
            }));
        }
예제 #14
0
        private async void createButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (displayNameTextBox.Text.Trim() == "")
            {
                MessageBox.Show("You have to have a display name. Sorry it's one of the few rules we have here.");
                return;
            }

            if (passwordTextBox.Password == doublePasswordTextBox.Password)
            {
                if (passwordTextBox.Password.Length < 6)
                {
                    MessageBox.Show("Hold up, wait a minute, your password is way too short (must be 6 characters or greater)");
                    return;
                }

                createButton.IsHitTestVisible = false;
                createButton.Text             = "";
                progressBar.Visibility        = System.Windows.Visibility.Visible;
                ParseUser newUser = new ParseUser();
                newUser.Email          = emailTextBox.Text;
                newUser.Username       = emailTextBox.Text;
                newUser["displayName"] = displayNameTextBox.Text;
                newUser["favorites"]   = new List <ParseObject>();
                newUser.Password       = passwordTextBox.Password;

                try
                {
                    progressBar.Visibility = System.Windows.Visibility.Collapsed;
                    await newUser.SignUpAsync();

                    NavigationService.GoBack();
                }
                catch (Exception ex)
                {
                    createButton.IsHitTestVisible = true;
                    createButton.Text             = "OK";
                    progressBar.Visibility        = System.Windows.Visibility.Collapsed;

                    if (ex.Message.Contains("the email address"))
                    {
                        MessageBox.Show("Look's like somebody else is using that email address...");
                    }
                    else if (ex.Message.Contains("invalid email"))
                    {
                        MessageBox.Show("That's not even an email address!");
                    }
                    else
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("Your passwords don't match. Fix it.");
            }
        }
예제 #15
0
        public async Task <bool> Signup(User user, byte[] profilePicture)
        {
            try {
                var newUser = new ParseUser()
                {
                    Email    = user.Email,
                    Username = user.Email,
                    Password = user.Password,
                };
                newUser.Add("name", user.Name);

                if (profilePicture != null)
                {
                    ParseFile file = new ParseFile("profilePicture.jpg", profilePicture);
                    await file.SaveAsync();

                    newUser.Add("profilePicture", file);
                }

                await newUser.SignUpAsync();
            } catch (ParseException pex) {
                string exMessage;
                if (pex.Code == ParseException.ErrorCode.UsernameTaken)
                {
                    exMessage = pex.Message;
                }
                else if (pex.Code == ParseException.ErrorCode.EmailTaken)
                {
                    exMessage = pex.Message;
                }
                else
                {
                    exMessage = pex.Message;
                }
                AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.AppContext);
                alert.SetTitle(AppConfig.ApplicationName);
                alert.SetMessage(exMessage);
                alert.SetPositiveButton("OK", (senderAlert, args) => {
                });
                alert.Show();
            } catch (InvalidOperationException inv) {
                AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.AppContext);
                alert.SetTitle(AppConfig.ApplicationName);
                alert.SetMessage(inv.Message);
                alert.SetPositiveButton("OK", (senderAlert, args) => {
                });
                alert.Show();
            } catch (Exception ex) {
                AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.AppContext);
                alert.SetTitle(AppConfig.ApplicationName);
                alert.SetMessage(ex.Message);
                alert.SetPositiveButton("OK", (senderAlert, args) => {
                });
                alert.Show();
            }

            return(IsLoggedIn());
        }
예제 #16
0
 public async void SaveParseUser(string className, ParseUser parseUser)
 {
     try {
         await parseUser.SignUpAsync();
     } catch (Exception e) {
         Console.WriteLine(e.Message);
     }
     //await parseUser.SaveAsync ();
 }
예제 #17
0
    IEnumerator Async_SignUpTask()
    {
        var user = new ParseUser()
        {
            Username = Control_UserInfoPanel_SignUp_EMail.label.text,
            //Email = Control_UserInfoPanel_SignUp_EMail.label.text,
            Password = Control_UserInfoPanel_SignUp_Passwd.label.text,
        };

        // other fields can be set just like with ParseObject
        user["gender"] = Control_UserInfoPanel_SignUp_Gender.value;

        user["Age"]       = int.Parse(Control_UserInfoPanel_SignUp_Age.label.text);
        user["Education"] = Control_UserInfoPanel_SignUp_Education.value;

        //public UIPopupList  Control_UserInfoPanel_SignUp_Education;
        //public UIInput    Control_UserInfoPanel_SignUp_Age;

        Control_UserInfoPanel_SignUp_WarningInfo.text = "註冊中..";

        Task signUpTask = user.SignUpAsync();

        while (!signUpTask.IsCompleted)
        {
            yield return(null);
        }


        Control_UserInfoPanel_SignUp_FuncBtn.enabled = true;

        if (signUpTask.IsFaulted)
        {
            Debug.Log("Sign Up Fail");
            Control_UserInfoPanel_SignUp_WarningInfo.text = "註冊失敗";
        }
        else
        if (signUpTask.IsCanceled)
        {
            Debug.Log("Sign Up Cancel");
            Control_UserInfoPanel_SignUp_WarningInfo.text = "Cancel!";
        }
        else
        if (signUpTask.IsCompleted)
        {
            Debug.Log("Success");
            Control_UserInfoPanel_SignUp_WarningInfo.text = "Success!";

            //if(  SQLite_TableContentCount("roundlog"  ) ==0 )
            //SQLite_InsertDefault( "roundlog");
            xMain.Instance.SQLite_InsertRoundWithUserid(Control_UserInfoPanel_SignUp_EMail.label.text);



            CheckExistUser();
        }
    }
예제 #18
0
        private void SignUp()
        {
            ParseUser userToSignUp = new ParseUser()
            {
                Username = CurrentUser.Username,
                Password = CurrentUser.Password
            };

            userToSignUp.SignUpAsync();
        }
예제 #19
0
        void IDbType <IDbUser> .Create()
        {
            var user = new ParseUser {
                Username = ((IDbUser)this).UserLogin, Password = ((IDbUser)this).Password
            };

            var callback = new Action(() => { ((IDbUser)this).Id = user.ObjectId; DbUser = this; });

            CoreContext.StartCoroutine(RunRequest <IDbUser>(user.SignUpAsync(), ((IDbUser)this).ItemHasBeenCreatedCommandName, callback));
        }
예제 #20
0
        public async void SignUpUser(ParseUser userData)
        {
            try {
                await userData.SignUpAsync();                  //sign up the user

                //we need a way ot telling the user that the sign up is successful
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }
예제 #21
0
        public override void OnEnter()
        {
            ParseUser user = new ParseUser()
            {
                Username = username.IsNone ? email.Value : username.Value,
                Password = password.Value,
                Email    = email.Value
            };

            _task = user.SignUpAsync();
        }
예제 #22
0
        /// <summary>
        /// Buttons the create account touch up inside.
        /// </summary>
        /// <param name="sender">Sender.</param>
        async partial void btnCreateAccount_TouchUpInside(UIButton sender)
        {
            var firstName       = txtFirstName.Text;
            var lastName        = txtLastName.Text;
            var username        = txtUser.Text;
            var password        = txtPassword.Text;
            var confirmPassword = txtConfirm.Text;

            var alert = new UIAlertView();

            if ((string.IsNullOrEmpty(username)) || (string.IsNullOrEmpty(password)) ||
                (string.IsNullOrEmpty(firstName)) ||
                (string.IsNullOrEmpty(lastName)))

            {
                alert = new UIAlertView("Input Validation Failed", "Please complete all the input fields!", null, "OK");
                alert.Show();
            }
            else
            {
                if (password != confirmPassword)
                {
                    alert = new UIAlertView("Input Validation Failed", "Password and Confirm Password must match!", null, "OK");
                    alert.Show();
                }
                else
                {
                    try
                    {
                        var user = new ParseUser()
                        {
                            Username = username,
                            Password = password,
                        };

                        user["LastName"]  = lastName;
                        user["FirstName"] = firstName;

                        await user.SignUpAsync();

                        alert = new UIAlertView("Account Created", "Your account has been successfully created!", null, "OK");
                        alert.Show();

                        NavigationController.PopViewController(true);
                    }
                    catch (Exception ex)
                    {
                        var error = ex.Message;
                        alert = new UIAlertView("Registration Failed", "Sorry, we might be experiencing some connectivity difficulties or your email is already in the system!", null, "OK");
                        alert.Show();
                    }
                }
            }
        }
예제 #23
0
    void CreateNewUser(string userName, string password, string email)
    {
        var user = new ParseUser()
        {
            Username = userName,
            Password = password,
            Email    = email
        };

        user.SignUpAsync();
        Application.LoadLevel("GameMenu");
    }
예제 #24
0
        private async void goToRegistrarusuario(object sender, RoutedEventArgs e)
        {
            var user = new ParseUser()
            {
                Username = nombre.Text,
                Password = password.Text,
                Email    = correo.Text
            };

            user["profesion"] = profesion.Text;
            await user.SignUpAsync();
        }
예제 #25
0
        async void Register(String username, String mail, String pass)
        {
            var user = new ParseUser()
            {
                Username = username,
                Password = pass,
                Email    = mail,
            };



            await user.SignUpAsync();
        }
예제 #26
0
 public async Task CreateUserAsync(string username, string email, string password)
 {
     if (username != "" && email != "" && password != "")
     {
         var user = new ParseUser()
         {
             Username = username,
             Password = password,
             Email    = email
         };
         await user.SignUpAsync();
     }
 }
예제 #27
0
    public void createnewaccount(ParseFile file)
    {
        Loom.QueueOnMainThread(() => {
            if (name.value != null && password.value != null && place.value != null && passwordconfirm.value != null)
            {
                //if(password.value==passwordconfirm.value){
                var user = new ParseUser()
                {
                    Username = email.value,
                    Password = password.value,
                    Email    = email.value
                };
                user ["file"]  = file;
                user ["name"]  = name.value;
                user ["place"] = place.value;

                if (password.value == passwordconfirm.value)
                {
                    Task signUpTask = user.SignUpAsync().ContinueWith(t =>
                    {
                        Loom.QueueOnMainThread(() => {
                            if (t.IsFaulted || t.IsCanceled)
                            {
                                // The login failed. Check t.Exception to see why.
                                Debug.Log("Parse Registration failed!");
                                Debug.Log(t.Exception);
                                failed.SetActive(true);
                            }
                            else
                            {
                                Debug.Log("Parse Registration was successful!");

                                /*TweenTransform transform=GameObject.Find("SignUp").GetComponent<TweenTransform>();
                                 * transform.ResetToBeginning();*/

                                success.SetActive(true);
                            }
                        });
                    });
                }
                else
                {
                    Debug.Log("passwordfailed");
                }
                //}
                //if(password!=passwordconfirm){
                //	Debug.Log("password!=passwordconfirm");
                //}
            }
        });
    }
    void CreateUser()
    {
        var user = new ParseUser()
        {
            Username = "******",
            Password = "******",
            Email    = "*****@*****.**"
        };

        // other fields can be set just like with ParseObject
        user["phone"] = "650-555-0000";

        user.SignUpAsync();
    }
예제 #29
0
        public async Task <UserModel> Register(RegisterModel model)
        {
            UserModel newUser;

            try
            {
                var user = new ParseUser()
                {
                    Username = model.Username,
                    Email    = model.Email,
                    Password = model.Password
                };
                user["nameSurname"]  = model.nameSurname;
                user["phoneNumber"]  = model.phoneNumber;
                user["isVet"]        = model.isVet;
                user["withFacebook"] = model.withFacebook;

                await user.SignUpAsync();

                newUser = new UserModel()
                {
                    IsSuccess = true,
                    Message   = "",
                    User      = ParseUser.CurrentUser
                };
            }

            catch (Exception e)
            {
                string message = "";

                if (e.Message == "Account already exists for this username.")
                {
                    message = "kullanıcı adı";
                }
                else if (e.Message == "Email address format is invalid.")
                {
                    message = "e -posta adresi";
                }

                newUser = new UserModel()
                {
                    IsSuccess = false,
                    Message   = message,
                    User      = null
                };
            }

            return(newUser);
        }
예제 #30
0
        public Task TestSignUpWithInvalidServerData()
        {
            IObjectState state = new MutableObjectState {
                ServerData = new Dictionary <string, object>()
                {
                    { "sessionToken", "llaKcolnu" }
                }
            };
            ParseUser user = ParseObjectExtensions.FromState <ParseUser>(state, "_User");

            return(user.SignUpAsync().ContinueWith(t => {
                Assert.True(t.IsFaulted);
                Assert.IsInstanceOf <InvalidOperationException>(t.Exception.InnerException);
            }));
        }