Page 1 of 2
Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 4:28 pm
by Curiousbystander
So I've gotten this far
global gUser,gPassword
on logIn
ask "Enter your username here:"
put it into tUsername
ask "Enter your password here:"
put it into tPassword
if tUsername = gUser and tPassword = gPassword then
goToStart
otherwise
answer "The username or password was incorrect"
end if
end login
But how would I make a register button to this, I need these to connect. So when registered its a valid login and when input right it goes to the next card.
EDIT: Hello I am a curious bystander and I am new here and hello world
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 4:45 pm
by Klaus
Hi Curiousbystander,
welcome to the forum!
Well except for the syntax this should be working.
Change this, and please use the CODE tag after pasting your script here.
This way the formatting will be kept.
Code: Select all
on logIn
ask "Enter your username here:"
put it into tUsername
ask "Enter your password here:"
put it into tPassword
if tUsername = gUser and tPassword = gPassword then
## goToStart
go next cd
## otherwise :-)
ELSE
answer "The username or password was incorrect"
end if
end login
But how would I make a register button to this, I need these to connect. So when registered its a valid login and when input right it goes to the next card.
What exactly do you mean with "register button"?
Best
Klaus
P.S.
Personal note: A little "Hello" or something would not have hurt for the very first posting.
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 4:48 pm
by FourthWorld
Where will this registration be sent?
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 4:53 pm
by dunbarx
Hi.
You have a few issues, mainly with the language, but also because you have elements within your handler which contain no data.
Check out this stack. It does what I think you intended. The details that are built-in can be modified to your liking later.
Craig
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 6:47 pm
by Curiousbystander
Hi, thank you for the replies.
Sorry I wasn't being clear enough. So what I'm trying to do is have a register button, like if I clcik register right. I type in the username and password that I want, then the login button recognizes the data and I can use that to login with.
Hope that sums it up better, that's what I am looking for here.
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 7:02 pm
by FourthWorld
Is the data stored only locally?
And is this for desktop or mobile?
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 8:42 pm
by dunbarx
Can anyone tell me what a "register" button looks like, and how it works? Does clicking on a certain part of such a control do different things?
And how it differs from a "Login" button?
Craig
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 8:54 pm
by Curiousbystander
Stored locally yeah,
Desktop.
I mean its just a normal button thats going to say register. U click on it and i want a pop up to say "what username do you want" and then u type in whatever, and same thing for password. once those are typed in u use the login button and type in whatever u wrote in the register button and u can login.
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 10:23 pm
by dunbarx
Ah.
OK, nothing particularly special. Did you try either my stack or Klaus' handler?
The details in my stack are just about how you want to store the password and userName, and what you want to do afterwards. I just used two fields to hold the "correct" answers to the two questions. You will change that into whatever you want.
Craig
Re: Based on this code, how would I make a register button
Posted: Wed Sep 07, 2022 11:51 pm
by FourthWorld
Curiousbystander wrote: ↑Wed Sep 07, 2022 8:54 pm
Stored locally yeah,
Desktop.
I mean its just a normal button thats going to say register. U click on it and i want a pop up to say "what username do you want" and then u type in whatever, and same thing for password. once those are typed in u use the login button and type in whatever u wrote in the register button and u can login.
How sensitive is the data?
User accounts already require password to log in, so if your app needs a second password I'm guessing this is serious data, yes? If so, you'll want to encrypt the stored key, and in hash form only.
Can you tell us a bit about what the application does?
Re: Based on this code, how would I make a register button
Posted: Thu Sep 08, 2022 12:29 pm
by Curiousbystander
dunbarx wrote: ↑Wed Sep 07, 2022 10:23 pm
Ah.
OK, nothing particularly special. Did you try either my stack or Klaus' handler?
The details in my stack are just about how you want to store the password and userName, and what you want to do afterwards. I just used two fields to hold the "correct" answers to the two questions. You will change that into whatever you want.
Craig
Yes, I tried it. I understand it but not exactly what I was looking for but I'll hold on to it for future purposes.
FourthWorld wrote: ↑Wed Sep 07, 2022 11:51 pm
Curiousbystander wrote: ↑Wed Sep 07, 2022 8:54 pm
Stored locally yeah,
Desktop.
I mean its just a normal button thats going to say register. U click on it and i want a pop up to say "what username do you want" and then u type in whatever, and same thing for password. once those are typed in u use the login button and type in whatever u wrote in the register button and u can login.
How sensitive is the data?
User accounts already require password to log in, so if your app needs a second password I'm guessing this is serious data, yes? If so, you'll want to encrypt the stored key, and in hash form only.
Can you tell us a bit about what the application does?
Not sensitive at all, it's not going to be shown to anyone it's more of like a practise project. It's nothing serious just a test and try type of project to try to learn myself better.
Well to start with it's only a login and a register app and then I'll find out what I want to do with it on the next card lol. It's basically going to register an account locally, locally login and then it goes to the next card once it recognizes the account registered.
Re: Based on this code, how would I make a register button
Posted: Thu Sep 08, 2022 1:03 pm
by Klaus
Curiousbystander wrote: ↑Thu Sep 08, 2022 12:29 pm
dunbarx wrote: ↑Wed Sep 07, 2022 10:23 pm
Ah.
OK, nothing particularly special. Did you try either my stack or Klaus' handler?
The details in my stack are just about how you want to store the password and userName, and what you want to do afterwards. I just used two fields to hold the "correct" answers to the two questions. You will change that into whatever you want.
Craig
Yes, I tried it. I understand it but not exactly what I was looking for but I'll hold on to it for future purposes.
...
My handler is exactly what you were asking for.
The missing link/big question however is, when and how do you fill your two global variables with the correct values
so you can actually compare them in the handler?
Re: Based on this code, how would I make a register button
Posted: Thu Sep 08, 2022 2:01 pm
by Curiousbystander
Ok looks like ive confused myself here lol.
Ok, how would I make this button.. without the global variables. I want a login button and I want a register account button lets say.
I click on the register account button. It says "What would you like your username to be" I type that in. and then again "What would you like your password to be". I type that in as well. Now the LOGIN button will have that stored (locally) as said just testing project.
When I type in that in the login button it should go to the next card.
I realize I'm making shit harder than it's supposed to be lol
Re: Based on this code, how would I make a register button
Posted: Thu Sep 08, 2022 2:05 pm
by Klaus
AHA!
OK, in that case use the globals to store the users chosen username and password for comparing later.
Re: Based on this code, how would I make a register button
Posted: Thu Sep 08, 2022 2:25 pm
by Curiousbystander
Could you show me how, if possible.
I'm sitting here trying not working out for me