|
Hendon
|
Hendon
|
alias password { if (%password == on) { goto login } if (%password == off) { halt } :login .showmirc -t /set %times 1 ;/set %passwordtry1 = $?*="What is your password?" /set %passwordtry1 = $input($read($mircdirscript/insquotes.txt),pv,©º°¨¨°º© WELCOME HENDON ©º°¨¨°º©) if (%passwordtry1 == %yourpass) { goto success } if (%passwordtry1 != $1) { goto login2 } :login2 /set %times 2 ;/set %passwordtry2 = $?*="What is your password?" /set %passwordtry2 = $input(______ O_O ______,pow,©º°¨¨°º© INTRUDER ALERT ©º°¨¨°º©)) if (%passwordtry2 == %yourpass) { goto success } if (%passwordtry2 != $1) { goto login3 } :login3 /set %times 3 ;/set %passwordtry3 = $?*="What is your password?" /set %passwordtry3 = $input(______* ^ *______,poh,©º°¨¨°º© CODE RED ©º°¨¨°º©)) if (%passwordtry3 == %yourpass) { goto success } if (%passwordtry3 != $1) { goto sorry } :sorry if (%times == 3) { /showmirc -s | /echo 4 FAILED LOGIN } :success .showmirc -s /unset %passwordtry1 /unset %passwordtry2 /unset %passwordtry3 /unset %times }
menu status,menubar { Password System ( $+ %password $+ ) .On:/set %password on | /techo Password is now ON .- .Off:/set %password off | /techo Password is now OFF .- .Change Password:/newpass }
alias techo { if (%scriptstamp == 1) { echo -at %s $1- } else { echo -a %s $1- } }
alias newpass { /set %newpasstry $?*="Old password:" if (%newpasstry == %yourpass) { goto change } if (%newpasstry != $1) { goto sorry } :change /set %yourpass $?*="New password:" | halt /unset %newpasstry :sorry /techo Wrong password /unset %newpasstry }
================= I can't get my password to be correct, I'm sure %yourpass is password under my variables list and it's the only %yourpass there.
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
What is the exact part of the code you are having trouble with? The changing, the logging in? If it is logging in, I'd prolly use something like this. I will not store passwords themselves, but I will store them encrypted.
alias newpass {
[color:green]; $md5 - I work with encrypted passwords only[/color]
[color:green]; $input - because it is more versatile than $?[/color]
if ($md5($input(Input password:,p,input request)) == %mypassword) {
[color:green]; user input his correct password[/color]
[color:green]; input the pass twice to prevent typos![/color]
var %pass1 = $md5($input(Enter new password:,p,input request))
var %pass2 = $md5($input(Confirm new password:,p,input request))
if (%pass1 == %pass2) {
[color:green]; two entered passes are the same[/color]
set %mypassword %pass1
echo -a Your password has been changed.
}
else {
[color:green]; two entered passes are different[/color]
echo -a You entered two different passwords. Your password has not been changed.
}
}
else {
[color:green]; user input a wrong password[/color]
echo -a You have entered the wrong password.
}
}
You could of course make this nicer by adding popups boxes for the messages instead of using echo... Then for the authentication (assuming one gets 3 tries...)
[color:green]; a group to enable/disable the login code[/color]
#login on
alias login {
var %x = 1
[color:green]; allow for 3 attempts[/color]
while (%x <= 3) {
if ($md5($input(Input password:,p,input request)) == %mypassword) {
[color:green]; user has entered his password[/color]
echo -a Password accepted!
guser IDENTIFIED $nick 3
[color:green]; stop processing or he will be asked again![/color]
halt
}
else {
[color:green]; user provided a wrong password[/color]
echo -a You provided the wrong password. Please try again!
}
}
else {
[color:green]; Sorry, only 3 attempts allowed[/color]
echo -a You have tried to identify 3 times and failed. Goodbye.
}
}
#login end
And of course the necessary popups to turn the group on and off:
menu status,menubar {
$iif($group(#login) != on,Enable,Disable) Password System:$iif($group(#login) != on,.enable,.disable) #login
}
This is of course the very basics. I used the /guser to add the user to a userlist, then I would give access to people who have identified via the userlist (on LEVEL:EVENT.....)
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
Corrected version of the login alias:
#login on
alias login {
var %x = 0
[color:green]; allow for 3 attempts[/color]
while (%x < 3) {
inc %x
if ($md5($input(Input password:,p,input request)) == %mypassword) {
[color:green]; user has entered his password [/color]
echo -a Password accepted!
guser IDENTIFIED $nick 3
[color:green]; stop processing or he will be asked again! [/color]
halt
}
elseif (%x != 3) {
[color:green]; user provided a wrong password [/color]
echo -a You provided the wrong password. Please try again!
}
else {
[color:green]; Sorry, only 3 attempts allowed [/color]
echo -a You have tried to identify 3 times and failed. Goodbye.
}
}
}
#login end
|
|
|
|
Hendon
|
Hendon
|
The problem is with logging in. I can't seem to get the correct password. I tried your example as well and it's the same. I deleted away all variables and it's the same. Will it create it's own variable or do I have to do it?
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
Weird - I tried my example (hence the correction) and it works for me. I get three chances to login, then it aborts. If I enter the wrong password it asks again, if I enter the right one it accepts.
|
|
|
|
Hendon
|
Hendon
|
Ok, let's say you delete all related variables and unload all password stuffs. Reload it. What's the default password then? What variables are created when it's loaded?
I can't even change the password because I don't know the default password!
Last edited by Hendon; 02/09/03 07:47 AM.
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
[color:green]; to set a default password when you load the script[/color]
on *:LOAD: {
[color:green]; probably obsolete, but check for an existing pass nonetheless[/color]
if (!%mypassword) {
set %mypassword $md5(password)
echo -a Your default password is [color:red]password[/color]. Please change it with the popups!
}
}
[color:green] [/color]
[color:green]; expanded popups: added one to change the pass and to login[/color]
menu status,menubar {
Password system
.$iif($group(#login) != on,Enable,Disable) Password System:$iif($group(#login) != on,.enable,.disable) #login
.Change password:newpass
.Login:login
}
Of course you might wanna expand by only displaying the last two popups when the system is active, but I can't get that to work out on this box.
|
|
|
|
Hendon
|
Hendon
|
Wow this works. thanks a lot. you can actually type codes off the fly and you seem to like it.
oh by the way.. there seems to be something with /exit.. i tried doing an error and it did a /exit.. when i loaded it again another time all my remotes got unloaded.. is there a better way to /exit or something? Can i get back my remotes without doing it manually? ouch..
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
Don't understand what you mean with "i tried doing an error and it did a /exit"
|
|
|
|
Hendon
|
Hendon
|
Basically i edited the login code to this
else { ; Sorry, only 3 attempts allowed echo -a You have tried to identify 3 times and failed. Goodbye. /exit } }
Is this a forced quit? Is there something more subtle?
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
Password protecting mIRC from use? ewww...
|
|
|
|
Hendon
|
Hendon
|
Yes, my little sister wrecks havoc, and my less than IT literate friends wouldn't be able to mess around with my IRC. anything other than /exit that i could use?
|
|
|
|
Joined: Jan 2003
Posts: 2,973
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,973 |
how about using mirc lock feature?
|
|
|
|
|