javascript - For Firebase Simple Login, I have to login twice for it to register -
I'm sure that this is a problem for me, which is not fully understood asynchronous javascript, but I I will explain the problem. / P>
I have an email / password authenticated with Firebase, and I have a login page with the following form:
& lt; Form class = "form-signin" role = "form" action = "#" onsubmit = "return login (this);" & gt; & Lt; H2 class = "form-signin-title" & gt; Please login & lt; / H2 & gt; & Lt; Input type = "email" id = "email" class = "form-control" placeholder = "email address" required autofocus & gt; & Lt; Input type = "password" id = "password" class = "form-control" placeholder = "password" required & gt; & Lt; Button class = "BTN BTN-LG BTN-Primary BTN-Block" type = "Submit" & gt; Sign in & lt; / Button & gt; & Lt; / Form & gt;
When I click the button, I get the following error in my JS console that really flashes:
Unkit type error: property The token can not be read in the lower part of my head tag, I include the script "js / firebase.js" and this is the file:
P>var myRef = new firefighter ("https://xxxx.firebaseio.com"); Var auth = new FirebaseSimpleLogin (myRef, function (error, user) {if (error) {console.log (error);} and if (user) {console.log ("User ID:" + user.uid + ", Provider: "+ user.provider);} and {}}); Function Login (form) {auth.login ('password', {email: form.email.value, password: form.password.value}); }
After filling out the form, press the button and get the error, the field is empty and attached to the end of my URL is "? #" If I try to log in after this It works perfectly. thank you in advanced!
The first time you load this page and click on the "Login" form Doing is being submitted and the page is being reloaded, preventing simple login from being successfully completed. See.
Comments
Post a Comment