Password problem
#1

Having a problem with my login/registration system! When I register it saves the password to the player's file and everything..
but when you go to login on that account, if you put in any password like '123', it will still let you login.
Anyone can login to any ones accounts.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 2)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,2,3,"Registration","Type in a password to register","Register","Leave");
                return 1;
            }
            new INI:file = INI_Open(Path(playerid));
            INI_SetTag(file,"Player's Stats");
            INI_WriteString(file,"Password",(inputtext));
            INI_WriteInt(file,"Admin",0);
            INI_WriteInt(file,"Cash",25);
            INI_Close(file);
            return 1;
        }
    }
    if(dialogid == 1)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strcmp(inputtext,pInfo[playerid][Pass])) // Here
            {
                INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
                GivePlayerMoney(playerid,pInfo[playerid][Cash]);
            }
            else
            {
                ShowPlayerDialog(playerid,1,3,"Login","Type in your password to login\nIncorrect password!","Login","Leave");
                return 1;
            }
        }
    }
    return 1;
}
Reply
#2

First of all:
pawn Код:
if(strcmp(inputtext, pInfo[playerid][Pass], false) == 0)
https://sampwiki.blast.hk/wiki/strcmp

Second of all, if this doesn't work, show your loadaccount function...
Thirdly, HASH YOUR GOD DAMN PASSWORDS. Once player's find out that you can just look at what their password is, it's automatically a security threat to them and they will leave (if they're in good mind). Use Whirlpool or udb_hash to hash your passwords, I certainly wouldn't want some asshole looking through my file to find my password.
Reply
#3

you're using newbienoob's tutorial right?

Look below (ending of the tutorial). He mention something to fix this problem.
Reply
#4

My friend actually got that from there I think, so thanks Romel.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)