Whirlpool Doesn't Hash my password
#1

Hello i have one issue, when i register and later try login i can type any style of password and its still login me.
This is me register case INI
Код:
                new INI:File = INI_Open(UserPath(playerid));
                WP_Hash(buf, sizeof(buf), inputtext);
                INI_SetTag(File,"data");
                INI_WriteString(File, "pPassword", buf);
			    INI_WriteInt(File,"pXP",0);
			    INI_WriteInt(File,"pKills",0);
			    INI_WriteInt(File,"pDeaths",0);
			    INI_WriteInt(File,"pRank",0);
			    INI_WriteInt(File,"pEvac",0);
			    INI_WriteInt(File,"pAdminLevel",0);
			    INI_WriteInt(File,"pVipLevel",0);
			    INI_WriteInt(File,"pHour",0);
			    INI_WriteInt(File,"pMin",0);
			    INI_WriteInt(File,"pSec",0);
			    INI_WriteInt(File,"pMapsPlayed",0);
			    INI_WriteString(File,"pIP",IP);
                INI_Close(File);
And this is login case
Код:
    	case DIALOG_LOGIN:
        {
  			if(!response)
	        {
 				ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"Kicked",""chat" You must login to play at "NAME"","Close","");
				Kick(playerid);
	        }
            if(response)
            {
                new buf[129];
				WP_Hash(buf, sizeof(buf), inputtext);
				if(!strcmp(buf,pInfo[playerid][pPassword]))
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
                    pInfo[playerid][pLogged] = 1;
				    playedtimer[playerid] = SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
				    SendClientMessage(playerid,-1,""chat""COL_LGREEN" Logged in!");
				    printf("%s",pInfo[playerid][pPassword]);
This is Load public
Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_String("pPassword", pInfo[playerid][pPassword], 129);
    INI_Int("pXP",pInfo[playerid][pXP]);
    INI_Int("pKills",pInfo[playerid][pKills]);
    INI_Int("pDeaths",pInfo[playerid][pDeaths]);
    INI_Int("pRank",pInfo[playerid][pRank]);
    INI_Int("pEvac",pInfo[playerid][pEvac]);
    INI_Int("pAdminLevel",pInfo[playerid][pAdminLevel]);
    INI_Int("pVipLevel",pInfo[playerid][pVipLevel]);
    INI_Int("pHour",pInfo[playerid][pHour]);
    INI_Int("pMin",pInfo[playerid][pMin]);
    INI_Int("pSec",pInfo[playerid][pSec]);
    INI_Int("pMapsPlayed",pInfo[playerid][pMapsPlayed]);
    INI_Int("pAdminDuty",pInfo[playerid][pAdminDuty]);
    return 1;
}
Reply
#2

And exactly how is it supposed to compare passwords if the password only gets fetched after the comparison? It's simple logic, my friend.
Reply
#3

Give me example what are you talking about.
Reply
#4

This is what he meant
Код:
case DIALOG_LOGIN:
        {
  			if(!response)
	        {
 				ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"Kicked",""chat" You must login to play at "NAME"","Close","");
				Kick(playerid);
	        }
            if(response)
            {
                new buf[129];
				WP_Hash(buf, sizeof(buf), inputtext);
				INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);//Should be placed before checking so as data needed is fetched before checking.
if(!strcmp(buf,pInfo[playerid][pPassword]))
                {
                    
                    pInfo[playerid][pLogged] = 1;
				    playedtimer[playerid] = SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
				    SendClientMessage(playerid,-1,""chat""COL_LGREEN" Logged in!");
				    printf("%s",pInfo[playerid][pPassword]);
Reply
#5

Well still i can login with any type of password, its doesn't work.
Reply
#6

Have more ideas?
Reply
#7

Still need
Reply
#8

Bump
Reply
#9

Load your password and ONLY your password BEFORE you compare a user's password to their input. If the input is correct, THEN you can load the player's entire statistics.

If you don't understand, then I suggest you read a tutorial on user registration/login systems before attempting to create your own.
Reply
#10

Well i fix it cuz i didn't see one problem i used same login/register dialog like if player have account i still use Dialog_Register so i have to change it to Dialog_Login and now everything work fine.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)