javascript - Firebase authentication Return null statement -


how can manage execute statement in condition when firebase-authentication return null statement during create user registration successfully..

firebase.auth().createuserwithemailandpassword(email, pass).catch(function(error) {    var errorcode = error.code;   var errormessage = error.message;    if(errorcode == "auth/email-already-in-use"){ //condition working     alert(errormessage);   }   else if(errorcode == null){ //this condition not working     alert("registration successfully");   }   else{  //condition working     alert("weak password");   }  }); 

if start new activity have check current user , if user available can start second activity this

 auth = firebaseauth.getinstance(); // firebase auth instance      if (auth.getcurrentuser() != null) {         startactivity(new intent(login_activity.this, secondactivity.class));         finish();     } 

if users not available have redirect user login activity or user creating activity wish

authlistener = new firebaseauth.authstatelistener() {         @override         public void onauthstatechanged(@nonnull firebaseauth firebaseauth) {             firebaseuser user = firebaseauth.getcurrentuser();             if (user == null) {                  // user auth state changed - user null                 // launch login activity                  startactivity(new intent(secondactivity.this, login_activity.class));                 finish();             }         }     }; 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -