Thread: invalid password length detecter

Results 1 to 3 of 3
  1. #1 invalid password length detecter 
    Registered Member
    craig903's Avatar
    Join Date
    Sep 2007
    Age
    27
    Posts
    1,358
    Thanks given
    14
    Thanks received
    92
    Rep Power
    238
    ok this pieces of code detect if you have an invalid password length by meaning if it is too short

    we will be editing ur client.java unless you have a command handler

    ok add this to your custume command wether it is in ur client or a handler

    Code:
    if (command.startsWith("pass"))
    		{
    		if(command.substring(5).length() >= 4){
    			playerPass = command.substring(5);
    			message("Your new pass is \""+command.substring(5)+"\"");
    			}else{
    			message("try again invailid pasword length");
    		}}

    you might need to add a else before the "if" if you are adding this above another command if you do not put the else in when ment to it will result at around 100+ errors

    this part defently go'es into client.java

    now add this in there initilize method

    Code:
    		if (playerPass.length() <= 4 || playerPass.equals(" "))
    			{
    				message("you password has been changed to password, this normaly accours when you have");
    				message("a password under 4 characters long, also this happens when you dont have a password");
    				message("please type pass to renew it");
    				playerPass = password;
    			}
    add this with ur other ints
    Code:
    public String password = "password";


    there you go....
    rusult...

    if you have a password and its just a space it will automaticly be changed to password
    if you have a password smaller then 4 charicters long then it will automaticly changed to password.

    when you go to change ur pass word by typing :ass ###### and the password u try to change it to is below 4 charicters it will say

    invalid password length

    you will need to type :ass ##### again and make sure its above 4 charicters


    to change what ur password automaticly changes to change this

    [code]public String password = "#######"/code

    to change what length ur password has to be change the #### in this

    Code:
    if (command.startsWith("pass"))
    		{
    		if(command.substring(5).length() >= 3){
    			playerPass = command.substring(5);
    			message("Your new pass is \""+command.substring(5)+"\"");
    			}else{
    			message("try again invailid pasword length");
    		}}

    and change this #### to the same number you did above but add 1 on so if the above
    you put as 5...this 1 ur put as 6 this will make it so the password length has to be 6+

    Code:
    		if (playerPass.length() <= #### || playerPass.equals(" "))
    			{
    				message("you password has been changed to password, this normaly accours when you have");
    				message("a password under 4 characters long, also this happens when you dont have a password");
    				message("please type pass to renew it");
    				playerPass = password;
    			}

    i think that covers it all
    Visit Rune Miracle [Only registered and activated users can see links. ]
     

  2. #2  
    × Zenzie ×
    Guest
    You forgot to edit in client also.
     

  3. #3  
    Registered Member
    craig903's Avatar
    Join Date
    Sep 2007
    Age
    27
    Posts
    1,358
    Thanks given
    14
    Thanks received
    92
    Rep Power
    238
    Quote Originally Posted by × Zenzie × View Post
    You forgot to edit in client also.


    what do you mean zenzie.?

    ive edited it a bit tell you where the codes go, what file.

    command= in client.java or if u got a handler put in there

    and the init part go'es in client.....this has been updated into the tut


    also removed the "c." in the command as many learners will just add it to client causeing errors so if you do have a handler make sure to put a c before all the necerssey void names
    Visit Rune Miracle [Only registered and activated users can see links. ]
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •