public async Task<IHttpActionResult> SignUp([FromBody]Usuario user) { try { ParseUser usuario = new ParseUser() { Username = user.usuario, Password = user.psw, Email = user.correo }; usuario["nombre"] = user.nombre; Byte[] bytes = Convert.FromBase64String(user.foto); ParseFile foto = new ParseFile("foto.png", bytes); await foto.SaveAsync(); usuario["foto"] = foto; usuario["sexo"] = user.sexo; usuario["tipo"] = user.tipo; await usuario.SignUpAsync(); Usuario resp = new Usuario(); resp.usuario = user.usuario; resp.psw = user.psw; resp.correo = usuario.Get<string>("email"); resp.foto = usuario.Get<ParseFile>("foto").Url.AbsoluteUri; resp.sexo = usuario.Get<string>("sexo"); resp.tipo = usuario.Get<string>("tipo"); resp.nombre = usuario.Get<string>("nombre"); resp.ObjectId = usuario.ObjectId; return Ok(resp); } catch (ParseException e) { return InternalServerError(e); } }
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(); } }
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(); }
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); } } }); });*/ }
void Registration() { Debug.LogError("Registration has been called"); if (usernameRegister.text == "Your full name" || emailRegister.text == "Your email" || repassRegister.text == "Enter password again" || usernameRegister.text == "" || emailRegister.text == "" || passwordRegister.text == "" || repassRegister.text == "") { message = "Please enter all the fields"; Debug.LogError ("" +message); } else { if (passwordRegister.text == repassRegister.text) { Debug.LogError("Passwords Matched"); var userCurrent = new ParseUser(){ Username = usernameRegister.text, Email = emailRegister.text, Password = passwordRegister.text }; // Debug.LogError ("" +userCurrent); Task signUpTask = userCurrent.SignUpAsync(); message = "Sign up successful. Check your email for verification!"; } else { message = "Your Password does not match"; } } }
public virtual void AddUser(ParseDatastoreMaster pdm ){ pdm.Dismiss (); var user = new ParseUser() { Username = username.text, Password = password.text, Email = email.text }; user.SignUpAsync().ContinueWith (t => { if (t.IsFaulted || t.IsCanceled) { // The login failed. Check the error to see why. print ("signup failed!"); print (t.Exception.Message); pdm.updateLoginStateFlag = true; } else { // Login was successful. print ("signup success"); pdm.updateLoginStateFlag = true; } }); }
//Sample Parse Function public async Task RegUser (string un, string ps, string em) { ParseUser user = new ParseUser (); user.Username = un; user.Password = ps; user.Email = em; // other fields can be set just like with ParseObject //user ["phone"] = "415-392-0202"; try { await user.SignUpAsync (); Console.WriteLine ("Account Creation Success"); // Login was successful. //TODO: Open up a new page //await Navigation.PushModalAsync (new NEWPAGENAME () ); } catch (Exception e) { // The login failed. Check the error to see why. Console.WriteLine("Signup error: " + e.Message); DisplayAlert ("Error", e.Message, "OK", "Cancel"); } }
public static void createNewUser(string username, string password, System.Action<bool> complete) { ParseUser user = new ParseUser (){ Username = username, Password = password, Email = username + "@fakeEmailabc123.com" }; user.SignUpAsync().ContinueWith(t => { if (t.IsFaulted) { // Errors from Parse Cloud and network interactions using (IEnumerator<System.Exception> enumerator = t.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException error = (ParseException) enumerator.Current; // error.Message will contain an error message // error.Code will return "OtherCause" Debug.Log(error.Code + " : " + error.Message); complete(false); } } } else { complete(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; } }
private void SignUp() { ParseUser userToSignUp = new ParseUser() { Username = CurrentUser.Username, Password = CurrentUser.Password }; userToSignUp.SignUpAsync(); }
/// <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(); } } } }
public override void OnEnter() { ParseUser user = new ParseUser() { Username = username.IsNone ? email.Value : username.Value, Password = password.Value, Email = email.Value }; _task = user.SignUpAsync(); }
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(); }
private async void Inscription_Click(object sender, RoutedEventArgs e) { var user = new ParseUser() { Username = UserName.Text, Password = MDP.Password, Email = EmailName.Text }; await user.SignUpAsync(); user["type"] = "student"; Frame.GoBack(); }
void CreateNewUser(string userName, string password, string email) { var user = new ParseUser() { Username = userName, Password = password, Email = email }; user.SignUpAsync(); Application.LoadLevel("Demo"); }
// LOGIN / SIGNUP public async void LoginOrCreateAccount() { try { await ParseUser.LogInAsync("test", "test"); } catch { ParseUser newUser = new ParseUser() { Username = "******", Password = "******" }; await newUser.SignUpAsync(); } await GetUserTasks(); }
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(); }
async void btnOneTapSignUp_Clicked(object sender, EventArgs args) { var query = from dictionary in ParseObject.GetQuery("Dictionary") where dictionary.Get<int>("dicType") == 1 && dictionary.Get<bool>("isAvailable") select dictionary; IEnumerable<ParseObject> results = await query.Limit(1).FindAsync(); if (results == null || results.Count() <= 0) { await DisplayAlert ("Sign Up Failed", "There's no available usernames in the pool.", "OK"); return; } var dic = results.First(); // // or using LINQ // var query = ParseObject.GetQuery("GameScore").WhereEqualTo("playerName", "Dan Stemkoski"); // IEnumerable<ParseObject> results = await query.FindAsync(); if (dic == null) { await DisplayAlert ("Sign Up Failed", "There's no available usernames in the pool.", "OK"); return; } string userName = dic.Get<string> ("dicValue"); string password = "******"; var user = new ParseUser() { Username = userName, Password = password }; await user.SignUpAsync (); dic["isAvailable"] = false; await dic.SaveAsync (); await ParseUser.LogInAsync (userName, password); App.Database.DeleteAllLocalInfos (); LocalInfo localInfo = new LocalInfo (); localInfo.UserName = userName; localInfo.Passcode = password; localInfo.Active = true; App.Database.SaveLocalInfo (localInfo); lblTitle.Text = "Welcome " + userName; lblMessage.Text = "New user signed up: \n" + userName + " -- " + password; }
public async System.Threading.Tasks.Task SignUpUserAsync () { var parseUser = new ParseUser () { Username = "******", Password = "******", Email = "*****@*****.**" }; await parseUser.SignUpAsync (); await ParseUser.LogInAsync ("robobat91", "myOtherPassword"); }
public async Task CreateUserAsync(string username, string email, string password,byte[] profilepic) { if (username != "" && email != "" && password != "" && profilepic != null) { ParseFile file = new ParseFile ("avatar.jpeg", profilepic); await file.SaveAsync (); var user = new ParseUser () { Username = username, Password = password, Email = email, }; user ["ProfilePic"] = file; await user.SignUpAsync(); } }
private async void registrar(object sender, RoutedEventArgs e) { var user = new ParseUser() { Username = usern.Text, Password = passw.Text, }; user.Add("Name", name.Text); user.Add("Lastname", lastname.Text); user.Add("Ident", ident.Text); await user.SignUpAsync(); Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }
public void CreateUser() { var user = new ParseUser() { Username = SystemInfo.deviceUniqueIdentifier, Password = GenerateCode(), }; try { Task createUserTask = user.SignUpAsync(); } catch (Exception e) { Debug.Log(e); } }
private async void btnRegister_Click(object sender, RoutedEventArgs s) { try { var user = new ParseUser() { Username = txtUsername.Text.Trim(), Password = txtPassword.Text.Trim(), Email = txtEmail.Text.Trim() }; await user.SignUpAsync(); } catch (Exception e) { // The login failed. Check the error to see why. } }
public void CreateUser(string name) { _createdOnce = true; var user = new ParseUser() { Username = name, Password = GenerateCode(), }; try { Task createUserTask = user.SignUpAsync(); } catch (Exception e) { Debug.Log(e); } }
void createNewUser(string username, string password) { ParseUser user = new ParseUser (){ Username = username, Password = password, Email = "" }; user.SignUpAsync().ContinueWith(t => { if (t.IsFaulted) { // Errors from Parse Cloud and network interactions using (IEnumerator<System.Exception> enumerator = t.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException error = (ParseException) enumerator.Current; // error.Message will contain an error message // error.Code will return "OtherCause" } } } }); }
public async Task<Boolean> CreateUser(User userModel) { ParseUser newUser = new ParseUser() { Username = userModel._EmailAddress, Password = HashPassword(userModel._Password), Email = userModel._EmailAddress }; newUser["firstName"] = userModel._FirstName; newUser["lastName"] = userModel._LastName; newUser["salt"] = _Salt; try { await newUser.SignUpAsync(); return true; } catch (ParseException e) { TrackError(e); return false; } }
public async Task<RepositoryResponse<User>> RegisterUser(User user) { var response = new RepositoryResponse<User> { }; try { var userObject = new ParseUser() { Username = user.USERNAME, Password = user.PASSWORD }; userObject["Name"] = user.NAME; DependencyRepository DependencyContext = new DependencyRepository(); RepositoryResponse<ParseObject> Dependency = await DependencyContext.GetDependencyById(user.ID_DEPENDENCY); ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Dependency"); IEnumerable<ParseObject> result = await query.FindAsync(); var relation = userObject.GetRelation<ParseObject>("ID_Dependency"); relation.Add(Dependency.Data); await userObject.SignUpAsync(); response.Success = true; response.Data = userObject.ToUser(); // Register was successful. } catch (Exception ex) { response.Success = false; response.Error = ex; } return response; }
public async Task<bool> SignUpUserAsync(User user) { try { var parseUser = new ParseUser() { Username = user.Username, Password = user.Password, Email = user.Email }; await parseUser.SignUpAsync(); // Sign up succeeded return true; } catch (Exception e) { Debug.WriteLine(@" ERROR {0}", e.Message); return false; } }
private static async Task SignUpUserAsync() { var parseUser = new ParseUser() { Username = "******", Password = "******", Email = "*****@*****.**" }; await parseUser.SignUpAsync(); }
public async Task<bool> CreateUsersInCurrentCompany(string email, string username, string password, string role) { var currentUser = await UserUtility.GetCurrentParseUser(); if (currentUser == null) return false; if (currentUser["Role"].ToString() != UserRole.Admin) return false; var newUser = new ParseUser { Email = email, Username = username, Password = password, ["CompanyId"] = currentUser["CompanyId"].ToString(), ["PasswordFailures"] = 0, ["Role"] = role }; //TODO: add role to this user and role should be non-admin await newUser.SignUpAsync(); // We are logging out the user because sign up creates the user and logs in ParseUser.LogOut(); return true; }
/// <summary> /// Saves the provided <see cref="ParseUser"/> instance with the target Parse Server instance and then authenticates it on the target client. This method should only be used once <see cref="ParseClient.Publicize"/> has been called and <see cref="ParseClient.Instance"/> is the wanted bind target, or if <see cref="ParseObject.Services"/> has already been set or <see cref="ParseObject.Bind(IServiceHub)"/> has already been called on the <paramref name="user"/>. /// </summary> /// <param name="serviceHub">The <see cref="IServiceHub"/> instance to target when creating the user and authenticating.</param> /// <param name="user">The <see cref="ParseUser"/> instance to save on the target Parse Server instance and authenticate.</param> /// <param name="cancellationToken">The cancellation token.</param> public static Task SignUpAsync(this IServiceHub serviceHub, ParseUser user, CancellationToken cancellationToken = default) { user.Bind(serviceHub); return(user.SignUpAsync(cancellationToken)); }