Based on this code, how would I make a register button

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Curiousbystander
Posts: 20
Joined: Wed Sep 07, 2022 4:26 pm

Based on this code, how would I make a register button

Post by Curiousbystander » Wed Sep 07, 2022 4:28 pm

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
Last edited by Curiousbystander on Wed Sep 07, 2022 6:47 pm, edited 1 time in total.

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Based on this code, how would I make a register button

Post by Klaus » Wed Sep 07, 2022 4:45 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Based on this code, how would I make a register button

Post by FourthWorld » Wed Sep 07, 2022 4:48 pm

Where will this registration be sent?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Based on this code, how would I make a register button

Post by dunbarx » Wed Sep 07, 2022 4:53 pm

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
passwordTest.livecode.zip
(1.12 KiB) Downloaded 111 times

Curiousbystander
Posts: 20
Joined: Wed Sep 07, 2022 4:26 pm

Re: Based on this code, how would I make a register button

Post by Curiousbystander » Wed Sep 07, 2022 6:47 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Based on this code, how would I make a register button

Post by FourthWorld » Wed Sep 07, 2022 7:02 pm

Is the data stored only locally?

And is this for desktop or mobile?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Based on this code, how would I make a register button

Post by dunbarx » Wed Sep 07, 2022 8:42 pm

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

Curiousbystander
Posts: 20
Joined: Wed Sep 07, 2022 4:26 pm

Re: Based on this code, how would I make a register button

Post by Curiousbystander » 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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Based on this code, how would I make a register button

Post by dunbarx » 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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Based on this code, how would I make a register button

Post by FourthWorld » 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?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Curiousbystander
Posts: 20
Joined: Wed Sep 07, 2022 4:26 pm

Re: Based on this code, how would I make a register button

Post by Curiousbystander » 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.
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.

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Based on this code, how would I make a register button

Post by Klaus » Thu Sep 08, 2022 1:03 pm

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?

Curiousbystander
Posts: 20
Joined: Wed Sep 07, 2022 4:26 pm

Re: Based on this code, how would I make a register button

Post by Curiousbystander » Thu Sep 08, 2022 2:01 pm

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

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Based on this code, how would I make a register button

Post by Klaus » Thu Sep 08, 2022 2:05 pm

AHA! :D

OK, in that case use the globals to store the users chosen username and password for comparing later.

Curiousbystander
Posts: 20
Joined: Wed Sep 07, 2022 4:26 pm

Re: Based on this code, how would I make a register button

Post by Curiousbystander » Thu Sep 08, 2022 2:25 pm

Could you show me how, if possible.

I'm sitting here trying not working out for me

Post Reply