worried-byte-34540
11/29/2022, 11:09 PMbcrypt_verify(playerid, "OnPlayerLogin", inputtext, field); is loading the correct data, the hash is printing the correct hash on the console but for some reason it's ignoring the arugment on OnPlayerLogin public OnPlayerLogin(playerid, bool:success) and seem's to be ignoring the if(success) and going straight to the else does anyone have any thoughts on why it would do this?
https://pastebin.com/7jeJKJJaworried-byte-34540
11/30/2022, 1:33 AMrefined-agent-73926
11/30/2022, 2:03 AMworried-byte-34540
11/30/2022, 2:07 AMbcrypt_hash(playerid, "OnPlayerRegister", inputtext, 12);refined-agent-73926
11/30/2022, 2:09 AMrefined-agent-73926
11/30/2022, 2:11 AMworried-byte-34540
11/30/2022, 2:24 AMforward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
new password[64];
bcrypt_get_hash(password);
new query[256];
format(query, sizeof(query), "INSERT INTO `USERS` (`NAME`, `PASS`, `SCORE`, `KILLS`, `DEATHS`) VALUES ('%q', '%s', '%d', '%d', '%d')", ReturnName(playerid), password, GetPlayerScore(playerid), Character[playerid][pKills], Character[playerid][pDeaths]);
database_result = db_query(server_database, query);
db_free_result(database_result);
Character[playerid][pLoggedIn] = true;
SendServerMessage(playerid, "SERVER: You have successfully registered an account.");
printf(query);;
return 1;
}
``$2a$12$Ywy58I1o0I/sq0AzXO7rMe0IhapDMbtWFjzNLjIFGH4OoDtMKH/d``refined-agent-73926
11/30/2022, 2:48 AMrefined-agent-73926
11/30/2022, 3:07 AMworried-byte-34540
11/30/2022, 9:52 AM[02:05:42] SELECT `PASS` FROM `USERS` WHERE `NAME` = 'TEST' COLLATE NOCASE
[02:05:42] $2y$12$g41LTNRN/F3hChpt6ziVWeVUvsvzvhfza6cKe8hEs0H09hXA/gvwWrefined-agent-73926
11/30/2022, 9:54 AMrefined-agent-73926
11/30/2022, 9:59 AMNAME attribute unique in your db?worried-byte-34540
11/30/2022, 10:00 AMrefined-agent-73926
11/30/2022, 10:03 AMworried-byte-34540
11/30/2022, 10:05 AMrefined-agent-73926
11/30/2022, 10:08 AMrefined-agent-73926
11/30/2022, 10:11 AMworried-byte-34540
11/30/2022, 10:12 AMDialog:REGISTER(playerid, response, listitem, inputtext[])
{
if (response)
{
if(strlen(inputtext) < 6 || strlen(inputtext) > 24)
{
SendErrorMessage(playerid, "Your password must be from 6-8 Characters");
return ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "{FFFFFF}Register Account", "{FFFFFF}Please enter a password below to register an account:", "Enter", "Leave");
}
bcrypt_hash(playerid, "OnPlayerRegister", inputtext, 12);
return 1;
}
else
{
Kick(playerid);
}
return 1;
}
forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
new password[64];
bcrypt_get_hash(password);
new query[256];
format(query, sizeof(query), "INSERT INTO `USERS` (`NAME`, `PASS`, `SCORE`, `KILLS`, `DEATHS`) VALUES ('%q', '%s', '%d', '%d', '%d')", ReturnName(playerid), password, GetPlayerScore(playerid), Character[playerid][pKills], Character[playerid][pDeaths]);
database_result = db_query(server_database, query);
db_free_result(database_result);
Character[playerid][pLoggedIn] = true;
SendServerMessage(playerid, "SERVER: You have successfully registered an account.");
printf(query);;
return 1;
}refined-agent-73926
11/30/2022, 10:15 AMworried-byte-34540
11/30/2022, 10:16 AMworried-byte-34540
11/30/2022, 10:18 AM"pawn-lang/samp-stdlib",
"https://github.com/Sreyas-Sreelal/samp-bcrypt:0.3.4",
"Y-Less/sscanf:v2.13.2",
"Skeatza/I-ZCMD:final",
"Awsomedude/easyDialog:2.0",
"oscar-broman/sqlitei" full list of current dependencies im using toworried-byte-34540
11/30/2022, 10:31 AMrefined-agent-73926
11/30/2022, 11:18 AMrefined-agent-73926
11/30/2022, 11:21 AMShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "{FFFFFF}Register Account", "{FFFFFF}Please enter a password below to register an account:", "Enter", "Leave");
that's why I asked
and i have done a simple code to check in easydialog it is working fine for meworried-byte-34540
11/30/2022, 11:23 AMwas supposed to be Dialog_Show(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "{FFFFFF}Register Account", "{FFFFFF}Please enter a password below to register an account:", "Enter", "Leave");refined-agent-73926
11/30/2022, 11:27 AMworried-byte-34540
11/30/2022, 11:35 AMbcrypt_hash(playerid, "OnPlayerRegister", inputtext, 12); or here bcrypt_verify(playerid, "OnPlayerLogin", inputtext, field);
I think I might just have to find an alternative library
what did you use in your test?refined-agent-73926
11/30/2022, 11:38 AMC
#include <a_samp>
#include<easydialog>
#include<izcmd>
#include "../include/samp_bcrypt.inc"
CMD:test(playerid,params[]){
Dialog_Show(playerid, REGISTER, DIALOG_STYLE_PASSWORD,"{FFFFFF}Register Account", "{FFFFFF}Please enter a password below to register an account:", "Enter", "Leave");
return 1;
}
Dialog:REGISTER(playerid, response, listitem, inputtext[]){
if (response){
bcrypt_hash(playerid, "OnPlayerRegister", inputtext, 12);
return 1;
}
return 1;
}
forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid){
new hash[64];
bcrypt_get_hash(hash);
bcrypt_verify(playerid, "verify", "test", hash);
return 1;
}
forward verify(playerid,bool:success);
public verify(playerid,bool:success){
print(success ? "Yes" : "No");
return 1;
}
main() {
}worried-byte-34540
11/30/2022, 11:42 AMworried-byte-34540
11/30/2022, 11:59 AMrefined-agent-73926
11/30/2022, 11:59 AMwhite-lunch-43549
11/30/2022, 2:28 PMrefined-agent-73926
11/30/2022, 4:03 PMwhite-lunch-43549
11/30/2022, 4:22 PMrefined-agent-73926
11/30/2022, 5:15 PM