Page 1 of 1

Warning when password updating

Posted: Tue Oct 29, 2019 9:53 am
by Janusz
When I update the user password from the globeadmin login I have following warning in Debug (Password is updated succesfully).
This warning is not present when password is updated from user login
When I create new loging there is no warnings in debug.

Just for info - maybe to be take into account during next release.
(this concerns all releases previous ones and new one)

Code: Select all

[0] : 
===USER==========

globeadmin

===PDO MESSAGE=== 

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE `zzzzsys_user_id` = '5db5f850d5ba9ea'' at line 1

===SQL=========== 

UPDATE zzzzsys_user SET  WHERE `zzzzsys_user_id` = '5db5f850d5ba9ea';

===BACK TRACE====

....../nudata.php - line 348 (nuRunQuery)

...../nuapi.php - line 51 (nuUpdateDatabase)

Re: Warning when password updating

Posted: Tue Oct 29, 2019 10:14 am
by kev1n
Janusz, the reason is because the password is updated in Before Save with PHP code but the actual record is not saved and an error occurs because no db fields are updated and the generated SQL is then invalid.

Re: Warning when password updating

Posted: Tue Oct 29, 2019 10:28 am
by Janusz
Kev1n, the procedure to update psw is in PHP AS - so normally should work without warning (This warning is only on globeadmin login. When user updates by himself then it's OK with no warning). The query is generated propoerly it updates passwords correctly - but with additional warning.

Code: Select all

if('#check_password#' != ''){

	$pw	= md5('#check_password#');
	nuRunQuery("UPDATE zzzzsys_user SET sus_login_password = '$pw' WHERE zzzzsys_user_id = '#RECORD_ID#'");

}

Re: Warning when password updating

Posted: Wed Oct 30, 2019 8:35 am
by kev1n
Yes, the UPDATE query works perfectly.

What I was trying to say was that an attempt is made to save the record in the form as well.

Click on save button calls nuSaveAction() -> nuUpdateData() -> nuAjax() -> $.ajax() -> nuapi.php -> nuUpdateDatabase()

My theory is that the error occurs in the function nuUpdateDatabase().

However, the saving that is usually performed is not necessary for the password form, since a separate UPDATE statement is executed.