11 posts
Location
Poland
Posted 23 December 2012 - 09:17 AM
Maybe it's not very original idea, but I think It can be useful.
The API
SPS is a system to set, remove and force password anytime you want. Not much more I can tell about it…
Functions:Spoiler
setPassword(text) -Sets the main password, overrides the last main password.
addPassword(text) -Adds an optional password, if you add 5 passwords, user can enter any of them to pass. Idea by Mibac138
removePassword() -Removes all passwords
security() -Forces user to enter the main or any of the optional passwords Pastebin install:pastebin get Lx8enqbA sps
Example use: Protected HelloWorld: os.loadAPI("sps")
sps.setPassword("yourpassword")
sps.security()
print("Hello world!") --This line will only work if the password is correct
Force use to enter all your passwords:os.loadAPI("ps")
local list = {
"thecakeisalie",
"ilikecookies",
"passwordnumber3",
"notapassword",
}
for i = 1, #list do
ps.setPassword(list[i])
ps.security()
end
term.setTextColor(colors.green)
print("You did it! :D/>/>")
sleep(3)
term.clear()
Features:- Universality
- Color support
- Multiple use without any errors
Change log:Spoiler
1.1 -Protected program from terminating it.
1.2 -Added addPassword function. Now you can have multiple passwords at the same time.Thanks for reading! I hope you'll like it.
49 posts
Posted 23 December 2012 - 11:06 AM
?
1190 posts
Location
RHIT
Posted 23 December 2012 - 11:06 AM
Err… post fail?
2217 posts
Location
3232235883
Posted 23 December 2012 - 11:31 AM
-snip-
11 posts
Location
Poland
Posted 24 December 2012 - 09:42 PM
-
11 posts
Location
Poland
Posted 26 December 2012 - 11:58 PM
The thread has been edited. Try it now…
30 posts
Posted 14 January 2013 - 10:40 PM
this api is epic. I used it to create a double lock program it is 10 lines
11 posts
Location
Poland
Posted 17 January 2013 - 06:18 AM
this api is epic. I used it to create a double lock program it is 10 lines
Sorry for late reply, but thanks!
128 posts
Location
Poland
Posted 17 January 2013 - 06:56 AM
Preety cool! :)/>
I think you are from Poland is that right? ;)/>
11 posts
Location
Poland
Posted 17 January 2013 - 10:59 PM
I think you are from Poland is that right? ;)/>
Yes. That's right. ;)/>
And this is just my first API ever. So I didn't think it can get a positive opinion… But anyway seems like it can be useful.
128 posts
Location
Poland
Posted 20 January 2013 - 08:55 AM
:)/>
392 posts
Location
Christchurch, New Zealand
Posted 22 January 2013 - 05:55 PM
Under function security(), put
local pe = os.pullEvent
os.pullEvent = os.pullEventRaw
then at the bottom put
os.pullEvent = pe
This prevents people terminating the program.
You might also want to use a while loop instead of recursive calling the checkPassword function, to prevent stack overflow.
Either way, It's very good! Well done.
11 posts
Location
Poland
Posted 22 January 2013 - 11:55 PM
Thanks for hints and corrections! I wasn't actually going to edit it any more, but I can make a new version when I'll have some time.
You might also want to use a while loop instead of recursive calling the checkPassword function, to prevent stack overflow.
No, this method is good for me, because I can precisely define when the method should loop and when it should end. Well, for now it doesn't overflow, I'll think about it then.
7508 posts
Location
Australia
Posted 23 January 2013 - 12:02 AM
Well, for now it doesn't overflow, I'll think about it then.
Well if it hits 255 then it will overflow so…
11 posts
Location
Poland
Posted 24 January 2013 - 04:37 AM
I edited this topic to version 1.2.
The title should be:
[API] Smigolpol's Password System[v1.2]
But the editor doesn't let me save it like that… :huh:/> :mellow:/>