Password saves, but players can log-in by typing anything. -
Guitar - 09.09.2012
Hey,
So, my old case was
"This thread" where my registration system couldn't save the passwords, but thanks to the people who helped me there, it saves the password and hashes it by Whirlpool. So, my problem now is when a player logs-in "their password is saved" can just type any password or anything to log-in, let's say his password was 123456, he can type asdasd and just log-in :/. Why is it happening and how can I fix it?
This is what I've got in OnPlayerConnect:
pawn Код:
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
If you need anything else to know, please tell me!
Re: Password saves, but players can log-in by typing anything. -
Guitar - 09.09.2012
Sorry but Bump.
Re: Password saves, but players can log-in by typing anything. -
MarkoN - 09.09.2012
LoadUser_%s to > LoadUser_data
Re: Password saves, but players can log-in by typing anything. -
Guitar - 09.09.2012
Okay, why?
Update: Doesn't work, the problem is still there.
Re: Password saves, but players can log-in by typing anything. -
Guitar - 09.09.2012
Anyone?
Re: Password saves, but players can log-in by typing anything. - HuSs3n - 09.09.2012
show your LoadUser_%s callback
Re: Password saves, but players can log-in by typing anything. -
detter - 09.09.2012
post your login dialog
Re: Password saves, but players can log-in by typing anything. -
Guitar - 09.09.2012
My LoadUser is:
pawn Код:
forward LoadUser_data( playerid,name[],value[] );
public LoadUser_data( playerid,name[],value[] )
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Starter",PlayerInfo[playerid][pStarter]);
INI_Int("Zombie",PlayerInfo[playerid][pZombie]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Team",PlayerInfo[playerid][pTeam]);
INI_Int("Registered",PlayerInfo[playerid][pReg]);
INI_Int("Logged",PlayerInfo[playerid][pLogged]);
INI_Int("Jailed",PlayerInfo[playerid][pJailed]);
return 1;
}
and my Log-in Dialog:
OnPlayerConnect
pawn Код:
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
And, the one log-in one of the dialogs OnDialogResponse:
pawn Код:
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
new buf[145];
WP_Hash(buf, sizeof(buf), inputtext);
if(!strcmp(PlayerInfo[playerid][pPass], buf, true))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
Re: Password saves, but players can log-in by typing anything. -
detter - 09.09.2012
use this to detect if password is correct
Код:
if(strcmp(inputtext, PlayerInfo[playerid][pPass]) == 0)
{
}
and change
Код:
INI_Int("Password",PlayerInfo[playerid][pPass]);
to
Код:
INI_String("Password",PlayerInfo[playerid][pPass] ,50);
Re: Password saves, but players can log-in by typing anything. -
Guitar - 09.09.2012
This
pawn Код:
INI_String("Password",PlayerInfo[playerid][pPass],50);
Gives this:
pawn Код:
C:\Users\3hab\Desktop\BlackEvo 4\samp03e_svr_R2_win32\gamemodes\funland.pwn(266) : error 001: expected token: ")", but found "["
C:\Users\3hab\Desktop\BlackEvo 4\samp03e_svr_R2_win32\gamemodes\funland.pwn(266) : warning 215: expression has no effect
C:\Users\3hab\Desktop\BlackEvo 4\samp03e_svr_R2_win32\gamemodes\funland.pwn(266) : error 001: expected token: ";", but found "]"
C:\Users\3hab\Desktop\BlackEvo 4\samp03e_svr_R2_win32\gamemodes\funland.pwn(266) : error 029: invalid expression, assumed zero
C:\Users\3hab\Desktop\BlackEvo 4\samp03e_svr_R2_win32\gamemodes\funland.pwn(266) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.