void RegisterUser(string name, string email, string password) { taskCompletionListener.Success += TaskCompletionListener_Success; taskCompletionListener.Failure += TaskCompletionListener_Failure; mAuth.CreateUserWithEmailAndPassword(email, password) .AddOnSuccessListener(this, taskCompletionListener) .AddOnFailureListener(this, taskCompletionListener); }
private void SignUpUser(String email, String password) { Console.WriteLine("===========================> ", auth); Console.WriteLine("===========================> ", email); Console.WriteLine("===========================> ", password); auth.CreateUserWithEmailAndPassword(email, password) .AddOnCompleteListener(this, this); }
void RegisterUser(string name, string phone, string email, string password) { TaskCompletionListener.Success += TaskCompletionListener_Success; TaskCompletionListener.Failure += TaskCompletionListener_Failure; ShowProgressDialogue(); mAuth.CreateUserWithEmailAndPassword(email, password) .AddOnSuccessListener(this, TaskCompletionListener) .AddOnFailureListener(this, TaskCompletionListener); }
void RegisterUser(string name, string email, string phone, string pass) { TaskCompletionListener.Success += TaskCompetionListener_Success; TaskCompletionListener.Failer += TaskCompetionListener_Failer; dbAuth.CreateUserWithEmailAndPassword(email, pass) .AddOnSuccessListener(this, TaskCompletionListener) .AddOnFailureListener(this, TaskCompletionListener) ; }
void Regsiteruser(string email, string password) { mAuth.CreateUserWithEmailAndPassword(email, password); // Add Rider iamge storageReference = FirebaseStorage.Instance.GetReference("RiderIamges/" + PublicFunctions.generateID()); storageReference.PutBytes(imageArray) .AddOnSuccessListener(this) .AddOnFailureListener(this); }
private void RegisterButton_Click(object sender, EventArgs e) { string fullname, phone, email, password; fullname = fullNameText.EditText.Text; phone = phoneText.EditText.Text; email = emailText.EditText.Text; password = passwordText.EditText.Text; if (fullname.Length < 3) { Snackbar.Make(rootView, "Please Enter a valid Name", Snackbar.LengthShort).Show(); return; } else if (phone.Length < 9) { Snackbar.Make(rootView, "Please Enter a valid phone Number", Snackbar.LengthShort).Show(); return; } else if (!email.Contains("@")) { Snackbar.Make(rootView, "Please Enter a valid Email Address", Snackbar.LengthShort).Show(); return; } else if (password.Length < 8) { Snackbar.Make(rootView, "Please Enter a password longer than 8", Snackbar.LengthShort).Show(); return; } ShowProgressDialogue(); mAuth.CreateUserWithEmailAndPassword(email, password) .AddOnSuccessListener(this, taskCompletionListener) .AddOnFailureListener(this, taskCompletionListener); taskCompletionListener.Success += (o, g) => { DatabaseReference newDriverRef = database.GetReference("drivers/" + mAuth.CurrentUser.Uid); HashMap map = new HashMap(); map.Put("fullname", fullname); map.Put("phone", phone); map.Put("email", email); map.Put("created_at", DateTime.Now.ToString()); newDriverRef.SetValue(map); Snackbar.Make(rootView, "Driver was register successfully", Snackbar.LengthShort).Show(); StartActivity(typeof(MainActivity)); }; taskCompletionListener.Failure += (w, r) => { CloseProgressDialogue(); Snackbar.Make(rootView, "Registration fail, maybe email address already exist", Snackbar.LengthShort).Show(); }; }
private void RegisterButton_Click(object sender, EventArgs e) { fullname = fullnameText.EditText.Text; email = emailText.EditText.Text; password = passwordText.EditText.Text; confirm = confirmPasswordText.EditText.Text; if (fullname.Length < 4) { Toast.MakeText(this, "Please enter a valid name", ToastLength.Short).Show(); return; } else if (!email.Contains("@")) { Toast.MakeText(this, "Please enter a valid email address", ToastLength.Short).Show(); return; } else if (password.Length < 8) { Toast.MakeText(this, "Please enter a password upto 8 characters", ToastLength.Short).Show(); return; } else if (password != confirm) { Toast.MakeText(this, "Password does not match, please make correction", ToastLength.Short).Show(); return; } // Perform Registration ShowProgressDialogue("Registering you.."); mAuth.CreateUserWithEmailAndPassword(email, password).AddOnSuccessListener(this, taskCompletionListeners) .AddOnFailureListener(this, taskCompletionListeners); // Registration Success Callback taskCompletionListeners.Sucess += (success, args) => { HashMap userMap = new HashMap(); userMap.Put("email", email); userMap.Put("fullname", fullname); DocumentReference userReference = database.Collection("users").Document(mAuth.CurrentUser.Uid); userReference.Set(userMap); CloseProgressDialogue(); StartActivity(typeof(MainActivity)); Finish(); }; // Registration Failure Callback taskCompletionListeners.Failure += (failure, args) => { CloseProgressDialogue(); Toast.MakeText(this, "Registartion Failed : " + args.Cause, ToastLength.Short).Show(); }; }
void RegisterUser(string email, string pass) { //link the task Completion listener to functions tcl.Success += TaskCompletionListener_Success; tcl.Failure += TaskCompletionListener_Failure; //create the users using Firebase Auth and go to 1 of the two functions depending on success or failure auth.CreateUserWithEmailAndPassword(email, pass) .AddOnSuccessListener(tcl) .AddOnFailureListener(tcl); }
private void Dialog_onSignUpComplete(object sender, onSignUpEventArgs e) { signup_inputName = e.firstName; signup_inputLastName = e.lastName; signup_inputPhoneNumber = e.phone; signup_inputEmail = e.email; signup_inputPassword = e.password; auth.CreateUserWithEmailAndPassword(signup_inputEmail, signup_inputPassword).AddOnCompleteListener(this, this); progressBar.Visibility = ViewStates.Visible; }
public string SignUpWithEmailPassword(string email, string password) { try { var signUpTask = auth.CreateUserWithEmailAndPassword(email, password); return(""); } catch (Exception e) { return(e.Message); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SignIn); auth = FirebaseAuth.Instance; // Create your application here var edtEmail = FindViewById <EditText>(Resource.Id.edtEmail); var edtPassword = FindViewById <EditText>(Resource.Id.edtPassword); var btnSignIn = FindViewById <Button>(Resource.Id.btnSingIn); btnSignIn.Click += delegate { auth.CreateUserWithEmailAndPassword(edtEmail.Text, edtPassword.Text) .AddOnCompleteListener(this); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SignIn); auth = FirebaseAuth.Instance; var edtEmail = FindViewById <EditText>(Resource.Id.email); var edtPass = FindViewById <EditText>(Resource.Id.password); var signInBtn = FindViewById <Button>(Resource.Id.signInBtn); signInBtn.Click += delegate { auth.CreateUserWithEmailAndPassword(edtEmail.Text, edtPass.Text) .AddOnCompleteListener(this); }; }
// validates details and creates account private void CreateAccount(object sender, EventArgs e) { if (password.Text != confirmPassword.Text) { signupError.Text = "Your passwords did not match"; signupError.Visibility = ViewStates.Visible; } else if (IsEmpty(email) || IsEmpty(password)) { signupError.Text = "All fields must be filled"; signupError.Visibility = ViewStates.Visible; } else { auth.CreateUserWithEmailAndPassword(email.Text, password.Text).AddOnSuccessListener(this).AddOnFailureListener(this); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.Login); var mEmail = FindViewById <EditText>(Resource.Id.txtEmailLogIn); var mPass = FindViewById <EditText>(Resource.Id.txtPassLogIn); var mBtnReg = FindViewById <Button>(Resource.Id.btnRegisterLogIn); var mBtnSignIn = FindViewById <Button>(Resource.Id.btnSignInLogIn); mBtnReg.Click += delegate { auth.CreateUserWithEmailAndPassword(mEmail.Text, mPass.Text) .AddOnCompleteListener(this); }; }
public async void SteamAuth(ulong userid) { SteamUserId = userid; firebase_database = new DatabaseHandler(); if (await firebase_database.AccountExistsAsync(SteamUserId.ToString())) { // If the Steam user exists, sign them in with the Steam user ID appended to '@clanbutton.com'. auth.SignInWithEmailAndPassword($"{SteamUserId.ToString()}@clanbutton.com", "nopass"); StartActivity(new Android.Content.Intent(this, typeof(MainActivity))); Finish(); } else { // Otherwise, create the user. auth.CreateUserWithEmailAndPassword($"{SteamUserId.ToString()}@clanbutton.com", "nopass").AddOnCompleteListener(this); // This then calls the OnCompleteListener method OnComplete(). } }
//add offline added data to firebase public async void Sync() { db.CreateDatabase(); var OfflineAddedUsers = db.GetOfflineAddedUsers(); var firebase = new FirebaseClient(FirebaseURL); // add offline added users to firebase database and authenticatio foreach (var user in OfflineAddedUsers) { var firebaseKey = (await firebase.Child(FirebaseUserChild).PostAsync <User>(user)).Key; user.FirebaseReference = firebaseKey.ToString(); db.UpdateUserTable(user); auth.CreateUserWithEmailAndPassword(user.Username, user.Password); } //add offline added images to firebase database and storage var offlineImages = db.GetOfflineAddedUserImages(); storage = FirebaseStorage.Instance; storageRef = storage.GetReferenceFromUrl(firebaseStorageReference); foreach (var image in offlineImages) { String guid = Guid.NewGuid().ToString(); var imagesref = storageRef.Child("images/" + guid); var filepath = Android.Net.Uri.Parse("file://" + image.ImageRef); var putfileResult = imagesref.PutFile(filepath); image.ImageRef = imagesref.ToString(); var firebaseReference = (await firebase.Child(FirebaseUserImageChild).PostAsync <UserImage>(image)).Key; image.FirebaseReference = firebaseReference; db.UpdateUserImageTable(image); } //add offline updated user details in firebase database var OfflineUpdatedUsers = db.GetOfflinUpdatedUsers(); foreach (var user in OfflineUpdatedUsers) { user.FirebaseUpdated = 1; await firebase.Child(FirebaseUserChild).Child(user.FirebaseReference).PatchAsync(user); db.UpdateUserTable(user); } }
private void BtnRegister_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(InputName.Text) && string.IsNullOrWhiteSpace(InputName.Text)) { InputName.Error = "Please provide your name"; return; } if (string.IsNullOrEmpty(InputSurname.Text) && string.IsNullOrWhiteSpace(InputSurname.Text)) { InputSurname.Error = "Please provide your surname"; return; } if (string.IsNullOrEmpty(InputEmail.Text) && string.IsNullOrWhiteSpace(InputEmail.Text)) { InputEmail.Error = "Please provide your email";//, ToastLength.Long).Show(); return; } if (string.IsNullOrEmpty(InputPhoneNumber.Text) && string.IsNullOrWhiteSpace(InputPhoneNumber.Text)) { InputPhoneNumber.Error = "Please provide your phone number";//, ToastLength.Long).Show(); return; } if (string.IsNullOrEmpty(InputPassword.Text) && string.IsNullOrWhiteSpace(InputPassword.Text)) { InputPassword.Error = "Please provide your password"; return; } BtnRegister.Enabled = false; loadingDialog = new IonAlert(context, IonAlert.ProgressType); loadingDialog.SetSpinKit("WanderingCubes") .SetSpinColor("#008D91") .ShowCancelButton(false) .Show(); auth = FirebaseAuth.Instance; auth.CreateUserWithEmailAndPassword(InputEmail.Text.Trim(), InputPassword.Text.Trim()) .AddOnFailureListener(this) .AddOnSuccessListener(this) .AddOnCompleteListener(this); }
public void CreateUser() { string emailText = email.GetComponentInChildren <TMP_InputField>().text; string passwordText = password.GetComponentInChildren <TMP_InputField>().text; string passConfirmText = passwordConfirm.GetComponentInChildren <TMP_InputField>().text; string username = userName.GetComponentInChildren <TMP_InputField>().text; if (passwordText != passConfirmText) { Debug.Log("Ta password dn einai idia"); // Display error mpla mpla registerError.SetActive(true); registerError.GetComponent <TextMeshProUGUI>().text = "Passwords do not match"; return; } else { registerError.SetActive(false); } FirebaseAuth.CreateUserWithEmailAndPassword(emailText, passwordText, username, gameObject.name, "Good", "DisplayError"); }
private void SignUpUser(string email, string pass) { #pragma warning disable CS0618 // El tipo o el miembro están obsoletos process = new ProgressDialog(this); #pragma warning restore CS0618 // El tipo o el miembro están obsoletos if (Error()) { auth.CreateUserWithEmailAndPassword(email, pass) .AddOnCompleteListener(this, this); process.SetMessage("Validando informacion, espere."); process.Show(); } else { if (process.IsShowing) { process.Dismiss(); } Snackbar snackBar = Snackbar.Make(signupLayout, "Register Failed, campos vacios " + emailError, Snackbar.LengthShort); snackBar.Show(); } }
//create a method that register email and password private void LoginUser(string email, string password) { try { //create a funtion that the user must re enter the password if (input_password.Text == reinput_password.Text) { //create a funtion that save email and password auth.CreateUserWithEmailAndPassword(email, password) .AddOnCompleteListener(this, this); } else { //creeate a funtion that catch is the password is not match Toast.MakeText(this, "Password do not match", ToastLength.Short).Show(); } } catch (Exception e) { //creeate a exception if the email is exsisting or empty Toast.MakeText(this, "Failed to Register", ToastLength.Short).Show(); } }
private void CreateAccount(string new_email, string new_password) { auth.CreateUserWithEmailAndPassword(new_email, new_password).AddOnCompleteListener(this); }
public async Task <bool> CreateUserAsync(string email, string pwd) { return(_auth .CreateUserWithEmailAndPassword(email, pwd).IsComplete); }
// Username is the email address provided void RegisterUser(string username, string password) { firebaseAuth.CreateUserWithEmailAndPassword(username, password).AddOnCompleteListener(this); }
/// <summary> /// Notifies firebase about new account /// </summary> /// <param name="email">Email to sign up</param> /// <param name="password">Password for new account</param> private void SignUpUser(string email, string password) { auth.CreateUserWithEmailAndPassword(email, password).AddOnCompleteListener(this, this); }
public void CreateUserWithEmailAndPassword() => FirebaseAuth.CreateUserWithEmailAndPassword(emailInputField.text, passwordInputField.text, gameObject.name, "DisplayInfo", "DisplayErrorObject");
private void RegisterButton_Click(object sender, EventArgs e) { fullname = fullnameText.EditText.Text; email = emailText.EditText.Text; password = passwordText.EditText.Text; confirmPass = confirmPasswordText.EditText.Text; if (fullname.Length < 4) { Toast.MakeText(this, "Please enter a valid name.", ToastLength.Short).Show(); return; } else if (!email.Contains('@')) { Toast.MakeText(this, "Please enter a valid email address.", ToastLength.Short).Show(); return; } else if (password.Length < 8) { Toast.MakeText(this, "Password must be 8 characters long.", ToastLength.Short).Show(); passwordText.EditText.Text = ""; confirmPasswordText.EditText.Text = ""; return; } else if (confirmPass != password) { Toast.MakeText(this, "Password does not match.", ToastLength.Short).Show(); passwordText.EditText.Text = ""; confirmPasswordText.EditText.Text = ""; return; } //Create user to firebase/REGISTRATION ShowProgressDialogue("Registering..."); mAuth.CreateUserWithEmailAndPassword(email, password) .AddOnSuccessListener(this, taskCompletionListener) .AddOnFailureListener(this, taskCompletionListener); //REGISTRATION SUCCESS CALLBACK taskCompletionListener.Success += (success, args) => { //add the records of the user HashMap userMap = new HashMap(); userMap.Put("email", email); userMap.Put("fullname", fullname); //Since the registration is successfull, the current user is not null. DocumentReference userReference = database.Collection("users").Document(mAuth.CurrentUser.Uid); //Save the usermap to the userReference userReference.Set(userMap); CloseProgressDialogue(); StartActivity(typeof(MainActivity)); Finish(); }; //REGISTRATION FAILURE CALLBACK taskCompletionListener.Failure += (failure, args) => { //Show message why the registration failed CloseProgressDialogue(); Toast.MakeText(this, "Registration failed : " + args.Cause, ToastLength.Short).Show(); }; }
// register button event handler private void RegisterButton_Click(object sender, EventArgs e) { string fullname, email, phone, password; // holders for the information provided by the user fullname = fullNameText.EditText.Text; phone = phoneText.EditText.Text; email = emailText.EditText.Text; password = passwordText.EditText.Text; // validation of user details if (fullname.Length < 3) { Snackbar.Make(rootView, "Please enter a valid name", Snackbar.LengthShort).Show(); return; } else if (phone.Length < 10) { Snackbar.Make(rootView, "Please enter a valid phone number", Snackbar.LengthShort).Show(); return; } else if (!email.Contains("@gmail.com, @uonbi.ac.ke, @students.uonbi.ac.ke")) { try { MailAddress m = new MailAddress(email); } catch (FormatException) { Snackbar.Make(rootView, "Please enter a valid email address", Snackbar.LengthShort).Show(); return; } } else if (password.Length < 8) { Snackbar.Make(rootView, "Please enter a password of upto 8 characters", Snackbar.LengthShort).Show(); return; } // register driver mAuth.CreateUserWithEmailAndPassword(email, password) .AddOnSuccessListener(this, taskCompletionListener) .AddOnFailureListener(this, taskCompletionListener); // using lamba expressions // on successful registration taskCompletionListener.Success += (o, g) => { DatabaseReference newDriverRef = database.GetReference("drivers/" + mAuth.CurrentUser.Uid); // key value object used to send data to our database HashMap map = new HashMap(); map.Put("fullname", fullname); map.Put("email", email); map.Put("phone", phone); map.Put("created_at", DateTime.Now.ToString()); newDriverRef.SetValue(map); //post status to db DatabaseReference DriverStatusRef = database.GetReference("driverApplications/" + mAuth.CurrentUser.Uid); HashMap mapStatus = new HashMap(); mapStatus.Put("status", "pending"); DriverStatusRef.SetValue(mapStatus); Snackbar.Make(rootView, "Driver was registered successfully", Snackbar.LengthShort).Show(); StartActivity(typeof(UploadsActivity)); }; // on failure taskCompletionListener.Failure += (w, r) => { Snackbar.Make(rootView, "Driver registration failed", Snackbar.LengthShort).Show(); }; }
private void SignUp(string fullname, string email, string password, string confirmPassword) { //Register funcionality if (!Helpers.Helper.IsValidEmail(email)) { Toast.MakeText(this, "Please provide a valid email", ToastLength.Short).Show(); return; } else if (password != confirmPassword) { Toast.MakeText(this, "Passwords does not match", ToastLength.Short).Show(); return; } ShowDialog("Registering..."); auth.CreateUserWithEmailAndPassword(email, password) .AddOnFailureListener(registrationListener) .AddOnSuccessListener(registrationListener); string downloadUrl = ""; HashMap userMap = new HashMap(); StorageReference storageReference = null; DocumentReference userReference = null; //Registration Success registrationListener.Success += (s, args) => { userReference = database .Collection("users") .Document(auth.CurrentUser.Uid); string userId = userReference.Id; userMap.Put("email", email); userMap.Put("fullname", fullname); userReference.Set(userMap); SetupPrototipeCollections(); if (fileBytes != null) { Console.WriteLine("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); storageReference = FirebaseStorage.Instance.GetReference("chatAppAvatars/" + userId); storageReference.PutBytes(fileBytes) .AddOnSuccessListener(listener) .AddOnFailureListener(listener); } else { CloseDialog(); StartActivity(typeof(LoginActivity)); Finish(); Toast.MakeText(this, "Registration succeed", ToastLength.Short).Show(); return; } }; //Registration Failure callback registrationListener.Failure += (f, args) => { CloseDialog(); Toast.MakeText(this, "Registration failed due to: " + args.Cause, ToastLength.Short).Show(); }; //Image Add success listener.Success += (success, args) => { if (storageReference != null) { Console.WriteLine("YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"); storageReference.DownloadUrl.AddOnSuccessListener(downloadUrlListener); //storageReference.DownloadUrl.AddOnSuccessListener(downloadUrlListener); } Console.WriteLine("NUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUL"); }; downloadUrlListener.Success += (success, args) => { downloadUrl = args.Result.ToString(); userReference = database .Collection("users") .Document(auth.CurrentUser.Uid); userMap.Put("image_id", downloadUrl); userReference.Set(userMap); CloseDialog(); Toast.MakeText(this, "Registration succeed", ToastLength.Short).Show(); StartActivity(typeof(LoginActivity)); Finish(); }; listener.Failure += (f, args) => { Toast.MakeText(this, "Cannot upload the image", ToastLength.Short).Show(); CloseDialog(); }; }
/// <summary> /// creates uer with email and password /// </summary> /// <param name="email">email</param> /// <param name="password">password</param> /// <returns>task that is supposed to create user</returns> public Task CreateUser(string email, string password) { return(auth.CreateUserWithEmailAndPassword(email, password)); }