Login/Register system problem
#1

Hello guys. I have followed some tutorials about login and register systems, and I managed to make one. The problem is that I can login with any password, no matter if it is the password that I registered with, or a random one.

Here's the code: http://pastebin.com/rn3mYng2

Is anything wrong in there? I think that the problem is at the "DIALOG_LOGIN" section. More precisely, when the script compares the hashed entered password with the existing one stored in the .ini.
Reply
#2

We need some more debug
pawn Код:
//Find
if(tries == 3) return Kick(playerid);
WP_Hash(hpassword, sizeof(hpassword), inputtext);

//Add below
printf("Stored hash: %s, passed hash: %s", pInfo[playerid][Password], hpassword);
Try to login, and show the results from console
Reply
#3

Here you go:
Код:
Stored hash: , passed hash: BE093C427BD728A214C8928C212A8CD5FE87F33A78E53EB7BBDC9E3B3532C668018801ACD6C3744AD3427E63BC715717BAACBA78FB8C4EBC54C49805F21EA597
And a picture: /imageshack/img843/1261/problemye.png.

This is the content of Opptur.ini:
Код:
[data]
AdminLevel = 0
Banned = 0
Deaths = 0
Kills = 0
Level = 1
Money = 5000
Password = CA5896BB0D5A4F31467AD7C06A13357436CBCFB415B953AA71817C99D4B65E7FC40EA6FFA887BA346B10ED4F78A739D91EBFB77BE561B90DE0A7BA6BD6F60F53
Reply
#4

pawn Код:
//Find
forward UserDataLoad_user(playerid, name[], value[]);
public UserDataLoad_user(playerid, name[], value[])
//Change to
forward UserDataLoad_data(playerid, name[], value[]);
public UserDataLoad_data(playerid, name[], value[])
Try this
Reply
#5

Now it is working. But why was that a problem? - I got it. It had to be the same as the tag.

Now I have another problem. No matter how many wrong passwords I enter, the number of tries won't raise, so I won't get kicked after 3 tries. Here's a screenshot: /imageshack/img195/7134/samp013cn.png.
Reply
#6

Another thing: if someone connects and presses "Register" without typing a password, the file will be created (it will be empty) and the account will be recognized as registered. This is the new code: http://pastebin.com/EZ2mz5RG.

Don't forget about the 3 tries kicker. Can you make me one?
Reply
#7

pawn Код:
//Find
new hpassword[129], tries;
//Change to
new hpassword[129];
static tries;
Ad. Register - weird. Let's try this
pawn Код:
//Find
if(strlen(inputtext) < 6) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "This account is not registered. To register, please enter your desired password below.\n\n{FF0000}Your password must be at least 6 characters long!", "Register", "Cancel");
//Change to
if(inputtext[0] == EOS || strlen(inputtext) < 6) {
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "This account is not registered. To register, please enter your desired password below.\n\n{FF0000}Your password must be at least 6 characters long!", "Register", "Cancel");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)