Creating a simple sign up/ log in screen from a tutorial and code not working properly?

I was making signup/login screen on mit app inventor, and in my code, everything makes sense - the fire base collects the data in textbox1 and passwordtextbox1, stores it in firebase real-time database ( which I have enabled and it stores the data there ) but after that, the problem occurs.

When testing it on the phone, it does the sign up code perfectly, but when I go to login, the error code I preprogrammed in shows up, and I don’t make mistakes in what I put into the app for login. I’m confused as to why this is happening, can someone tell me or tweak the code I have done below that could fix the problem?


1 Like

show your sign up procedure blocks

In firebase what is username, and pwassword?

Ciara - username

CiaraK2022 is password?

Yup, the example and password bit was me trying to see if it was just the combination of the words that was the problem

Also what do you mean by the sign up procedure blocks? I can show you what the sign up screen looks like, but I don’t think I have a sign up procedure other than the blocks that say “when signupbtn is clicked…”


try this simple method
image

if the firebase returns , value not found value mean ~ wrong user name..
if the firbase value not equal to password text, wrong password
else ( all conditions are true) so logged in success

But keep in mind, everytime if user save his username and if he use pre existing names, it will be overwritten so you must be cautious.. everytime make sure the user name taken by the user during sign up time is not found in your fdb

This is really great, thank you! I have one small question - is the button 1 in your example meant to be the log in button, or the sign up button?

from a tutorial

Which tutorial ?

This one

login

Even with this method, I can’t seem to log in with any of the pre-existing “accounts” made and stored on the firebase, it only shows “wrong username”, no matter how many times I put it in, letter for letter.

check whether project bucket is aded in designer page or not.. else it will always return wrong

during my attempt, i am strong with bucket

image
image

I do have it on ( I think )

The reason there’s copy copy at the end of it is because I was testing certain functions on the app and didn’t want to make any irreversible descisions

I still can’t figure out why my code isn’t working, my firebase gets the data, I’m wondering if it’s a case where the problem is getting the data out of the firebase

If the project bucket in your firebase data is "Bus_Project" then you need this in your designer settings as well.At the moment it says:

image

remove the "_copy_copy"

I have done that, and before it was displaying the wrong username message only, now it displays wrong password if i have both correct and wrong username if the username is wrong. I have the firebase connected, and I would want to use it over tiny db as firebase can store stuff like account information forever where as tiny db would mean your account would be gone if you deleted the app from your phone and files I think. But either way I don’t see why it doesn’t work, there’s no block issues.

Try like this:

Note: I would not be happy with this, or the original tutorial, if I wanted to use it in a real app, much more work required.....