SA-MP Forums Archive
Y_INI Invalid Password - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Y_INI Invalid Password (/showthread.php?tid=557362)



Y_INI Invalid Password - X|Dragon|X - 13.01.2015

pawn Код:
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER_1, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Registering...",""COLOR_RED"You have entered an invalid password.\n"COLOR_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Money",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Gender",0);
                INI_WriteInt(File,"Age",0);
                INI_Close(File);
Everytime i register and then the login dialog comes up and i try to login, i get the error invalid password.., what should i do? i dont know whats wrong


Re: Y_INI Invalid Password - Ahmad45123 - 13.01.2015

Show the login part.
And check that the file is created and filled...


Re: Y_INI Invalid Password - Sawalha - 13.01.2015

How did you load the stats ("INI_ParseFile" part)
Show me your loadaccount_user or such name callback


Re: Y_INI Invalid Password - nogh445 - 13.01.2015

It looks to me like you're using this tutorial: https://sampforum.blast.hk/showthread.php?tid=273088

if not you could probably look at it and figure out what is wrong with your system as this tutorial is functional with passwords.

When you Load the users data make sure in the quotes it says "Password" and not "pPass" or something, it has to say exactly whats in the players file


Re: Y_INI Invalid Password - X|Dragon|X - 13.01.2015

pawn Код:
{
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPassword])
                {
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Success!",""COLOR_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_WHITE"Login",""COLOR_RED"You have entered an incorrect password.\n"COLOR_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
And the file is created and filled and the password section is filled with the hashed password, but when i type in my password it says invalid
pawn Код:
public LoadUser_data(playerid, tag[], name[], value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPassword]);
    INI_Int("Money",PlayerInfo[playerid][pMoney]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Gender",PlayerInfo[playerid][pGender]);
    INI_Int("Age",PlayerInfo[playerid][pAge]);
    return 1;
}
I can't use another user system now, i've went through alot in my script


Re: Y_INI Invalid Password - Ahmad45123 - 13.01.2015

Quote:
Originally Posted by X|Dragon|X
Посмотреть сообщение
pawn Код:
{
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPassword])
                {
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Success!",""COLOR_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_WHITE"Login",""COLOR_RED"You have entered an incorrect password.\n"COLOR_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
And the file is created and filled and the password section is filled with the hashed password, but when i type in my password it says invalid
pawn Код:
public LoadUser_data(playerid, tag[], name[], value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPassword]);
    INI_Int("Money",PlayerInfo[playerid][pMoney]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Gender",PlayerInfo[playerid][pGender]);
    INI_Int("Age",PlayerInfo[playerid][pAge]);
    return 1;
}
I can't use another user system now, i've went through alot in my script
You have to load the data before checking the password and not after...

And also, as ***** said
Change the encryption to Whirlpool


Re: Y_INI Invalid Password - X|Dragon|X - 13.01.2015

I'll do so when I get the password to work first.


EDIT: I'll try that right now thx.

Can you explain to me where to excatly put the account load data..?


Re: Y_INI Invalid Password - X|Dragon|X - 13.01.2015

Because i tried whirlpool numerous times and it gave me errors, and when i post questions no one answers, and i cannot bump topics unless every 24 hours, what am i supposed to do..


Re: Y_INI Invalid Password - X|Dragon|X - 13.01.2015

Alright, so i added this ontop of my script
pawn Код:
native WP_Hash(buffer[],len,const str[]);
Now what do i do?


Re: Y_INI Invalid Password - Threshold - 14.01.2015

Did you read the Whirlpool thread at all?
https://sampforum.blast.hk/showthread.php?tid=65290

If nobody answers your thread, it's probably because you're asking questions that you can answer yourself.
pawn Код:
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER_1, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Registering...", ""COLOR_RED"You have entered an invalid password.\n"COLOR_WHITE"Type your password below to register a new account.", "Register", "Quit");
                new buf[129];
                WP_Hash(buf, sizeof(buf), inputtext);
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File, "data");
                INI_WriteString(File, "Password", buf);
                INI_WriteInt(File, "Money", 0);
                INI_WriteInt(File, "Admin", 0);
                INI_WriteInt(File, "Gender", 0);
                INI_WriteInt(File, "Age", 0);
                INI_Close(File);



Re: Y_INI Invalid Password - Camacorn - 16.01.2015

Asking for help with something that you MAYBE spent 30 seconds trying to figure out is ridiculous, spend a little time reading through the Whirlpool thread, and then come back and ask questions ( if any even remain ).