C
C#•3mo ago
CarlJohnson

Why does this not print the firstname and lastname

Yo, im trying to make a login function in c$. Logging in works but it does not want to print the first and last name it only prints welcome back. How come?
No description
No description
18 Replies
Esa
Esa•3mo ago
Bit difficult to say without seeing what accountsLogic.CheckLogin does.
CarlJohnson
CarlJohnsonOP•3mo ago
No description
CarlJohnson
CarlJohnsonOP•3mo ago
getbyusername basicaly gives you the object with the same username
ero
ero•3mo ago
where are you creating the user?
CarlJohnson
CarlJohnsonOP•3mo ago
in my sign up code i ask all values they need to put in and make it a Usermodel than i write the account to the database
ero
ero•3mo ago
the user must not exist, or your GetByUserName logic is flawed it can't be found, so you need to figure out why it can't be found
CarlJohnson
CarlJohnsonOP•3mo ago
but if it did not exist why does it print Welcome Back
ero
ero•3mo ago
i see, it doesn't print Welcome back anywhere else in your code?
CarlJohnson
CarlJohnsonOP•3mo ago
nope
ero
ero•3mo ago
where do you set first and last name? it would just be nice to see where you create the user
CarlJohnson
CarlJohnsonOP•3mo ago
like the usermodel class?
ero
ero•3mo ago
and whatever code registers/creates the user
CarlJohnson
CarlJohnsonOP•3mo ago
idk if the second picture is readable for you
No description
No description
ero
ero•3mo ago
and what does UserAccess.Write do? you just need to provide all the parts involved in this code, we can't just guess the implementation 😅
CarlJohnson
CarlJohnsonOP•3mo ago
No description
CarlJohnson
CarlJohnsonOP•3mo ago
🤣 too much different code I made a Tostring method for usermodel and i see that it gives the wrong ID, no firstname, no lastname, no username, good password, good isadmin
FusedQyou
FusedQyou•3mo ago
I suggest you validate that your database has the credentials added at all Idk what UserAccess is, but the next step is to go as deep as possible into the logic to the first instance where the user is fetched from the database. Validate that this has the data Finally, follow the flow and figure out why it suddenly disappeared We can't help you because you haven't shared the relevant code
gDotDev
gDotDev•3mo ago
Seems pretty simple to debug. Firstly run in debug mode and check what the value of first and last name are. If it’s only printing Welcome Back, I’d presume that first name and last name aren’t being set and are therefore default value of empty string. Once you deduce if this is the case, then debug line by line your code flow and work out why the values aren’t being set.
Want results from more Discord servers?
Add your server