Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Warning when password updating

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

Warning when password updating

Unread post 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)
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Warning when password updating

Unread post 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.
Janusz
nuBuilder Team
Posts: 508
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 10 times
Been thanked: 18 times

Re: Warning when password updating

Unread post 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#'");

}
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Warning when password updating

Unread post 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.
Post Reply