Based on this code, how would I make a register button
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Based on this code, how would I make a register button
One cannot use global variables to store anything that needs to survive sessions. Globals do not; they must be populated each and every time. Such data should be either in a field, a custom property or an external file. If you have concerns about security, though it sounds like you do not, let us know.
Craig
Craig
Re: Based on this code, how would I make a register button
Code: Select all
global gChosenName,gChosenPassword
## Better use another name for this handler, since it is not (yet) the LOGIN handler
## Of course you can and should change the handler and variable names to fit your needs.
on SetUserNamePWD
ask "What username do you want?"
put it into gChosenName
ask "What password do you want"
put it into gChosenPassword
end SetUserNamePWD
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Based on this code, how would I make a register button
Klaus.
Why are you still set on using globals? These die every time you quit LC.
Craig
Why are you still set on using globals? These die every time you quit LC.
Craig
Re: Based on this code, how would I make a register button
As Richard mentioned earlier, it's good practice not to store the password per se, but a 1-way hash of it (so that the password cannot be divined from stored data). When the user enters a password it should be hashed in the same way to compare with the stored hash if that makes sense...
look at messageDigest in the dictionary...
S.
look at messageDigest in the dictionary...
S.
Re: Based on this code, how would I make a register button
I didn't expect the spanish inquisition!
Why didn't anybody tell me?
Yes, sorry, Craig, pure lazyness, of course one needs to save these globals somewhere before quitting LC.
Re: Based on this code, how would I make a register button
It may a useful intermediary step, if for example there is a subsequent handler that stores the password. And of course the OP is just using this for test purposes
However in this context i would probably avoid using globals anyway, just a script local (ie replace the the 'global' keyword with 'local' - it then becomes a variable that is 'global' for the script only and available to all handlers below it).
S.
-
- Posts: 20
- Joined: Wed Sep 07, 2022 4:26 pm
Re: Based on this code, how would I make a register button
Thank you all for educating me.
It's working now, thank you again.
It's working now, thank you again.
Re: Based on this code, how would I make a register button
I highly recommend these stacks to get a grip of the basics of LC:
http://www.hyperactivesw.com/revscriptc ... ences.html
http://www.hyperactivesw.com/revscriptc ... ences.html
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Based on this code, how would I make a register button
@Klaus
Ha. Nobody does.
@CuriousBystander. It is important to understand these points, that is, security and also how to store data in your stacks. For the data, no variable of any kind will survive a new session. Your options are the three I mentioned earlier. I think you should practice using custom properties. They are wonderful and can store any kind of data.
Craig
Ha. Nobody does.
@CuriousBystander. It is important to understand these points, that is, security and also how to store data in your stacks. For the data, no variable of any kind will survive a new session. Your options are the three I mentioned earlier. I think you should practice using custom properties. They are wonderful and can store any kind of data.
Craig