Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void signUpUser(View view){
- EditText mailEditText = (EditText) findViewById(R.id.editText);
- EditText pwdEditTet = (EditText) findViewById(R.id.editText2);
- String email = mailEditText.getText().toString();
- String password = pwdEditTet.getText().toString();
- Log.d("Info",email);
- Log.d("Info",password);
- mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
- @Override
- public void onComplete(@NonNull Task<AuthResult> task) {
- try {
- AuthResult result = task.getResult();
- Log.d("Sign up", "createUserWithEmail:onComplete:" + task.isSuccessful());
- // If sign in fails, display a message to the user. If sign in succeeds
- // the auth state listener will be notified and logic to handle the
- // signed in user can be handled in the listener.
- if (!task.isSuccessful()) {
- Toast.makeText(MainActivity.this, R.string.auth_failed,
- Toast.LENGTH_SHORT).show();
- }else{
- Log.d("Sign up", "Sending verification email");
- // Sending the verification email
- //FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
- mAuth.getCurrentUser().sendEmailVerification()
- .addOnCompleteListener(new OnCompleteListener<Void>() {
- @Override
- public void onComplete(@NonNull Task<Void> task) {
- if (task.isSuccessful()) {
- Log.d("Email Sent", "Verification Email sent.");
- }else{
- Log.d("Email Sent",task.getException().getLocalizedMessage());
- }
- }
- });
- }
- } catch (Exception e){
- Toast.makeText(MainActivity.this,R.string.user_exist,Toast.LENGTH_SHORT).show();
- Log.e("Exception",e.getLocalizedMessage());
- }
- }
- });
- }
- 10-11 10:10:50.372 31518-31518/au.com.savedme D/Sign up: Sending verification email
- 10-11 10:10:51.438 31518-31518/au.com.savedme D/Email Sent: An internal error has occurred. [ USER_NOT_FOUND ]
- 10-11 10:11:00.429 31518-31538/au.com.savedme W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement