Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Error occurs when changing user password

Questions related to using nuBuilder Forte.
kev1n
nuBuilder Team
Posts: 4581
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 536 times
Contact:

Re: Error occurs when changing user password

Unread post by kev1n »

Does this select return any rows?

Code: Select all

SELECT *  FROM `zzzzsys_php` WHERE `sph_code` = 'CHANGEPASSWORD'
If not, run this INSERT statement to create the missing procedure.

Code: Select all

INSERT INTO `zzzzsys_php` (`zzzzsys_php_id`, `sph_code`, `sph_description`, `sph_group`, `sph_php`, `sph_run`, `sph_zzzzsys_form_id`, `sph_system`, `sph_global`, `sph_hide`) VALUES ('nu61eceada0768c21', 'CHANGEPASSWORD', 'Change user password', '', '$is = \'#old_password#\';\r\n$was = \'#new_password_check#\';\r\n$will = \'#new_password#\';\r\n$ses = \'#SESSION_ID#\';\r\n$userId = \"#USER_ID#\";\r\n\r\n//--\r\n\r\n$s = \"\r\n SELECT sss_access \r\n FROM zzzzsys_session\r\n WHERE zzzzsys_session_id = ?\r\n\";\r\n\r\n$t = nuRunQuery($s, array($ses));\r\n$r = db_fetch_object($t);\r\n$j = json_decode($r->sss_access);\r\n\r\n//--\r\n\r\n$s = \"\r\n SELECT sus_login_password\r\n FROM zzzzsys_user\r\n WHERE zzzzsys_user_id = ?\r\n\";\r\n\r\n$t = nuRunQuery($s, array($userId));\r\n$r = db_fetch_object($t);\r\n$current = $r->sus_login_password;\r\n\r\n$useMd5 = $_SESSION[\'nubuilder_session_data\'][\'USE_MD5_PASSWORD_HASH\'] == true;\r\n\r\nif ($useMd5) {\r\n $check = md5($is) == $current;\r\n} else {\r\n $check = password_verify($is, $current);\r\n}\r\n\r\nif ($check == false) {\r\n nuDisplayError(nuTranslate(\'Incorrect Password\'));\r\n return;\r\n} \r\n\r\n//--\r\n\r\n$p = nuProcedure(\'nuCheckPasswordPolicy\');\r\n\r\nif($p != \'\'){\r\n\r\n eval($p);\r\n \r\n if($check == false){\r\n return;\r\n }\r\n\r\n}\r\n\r\n//--\r\n\r\nif($will == $was){\r\n\r\n $s = \"\r\n\r\n UPDATE zzzzsys_user \r\n SET sus_login_password = ?\r\n WHERE zzzzsys_user_id = ?\r\n \r\n \";\r\n\r\n $pwHash = $useMd5 == true ? md5($will) : nuPasswordHash($will);\r\n\r\n nuRunQuery($s, array($pwHash, $userId));\r\n\r\n nuSetUserJSONData(\'PASSWORD_CHANGED_TIME\', time() , $userId);\r\n nuSetUserJSONData(\'PASSWORD_CHANGED_SOURCE\', \'user\', $userId);\r\n \r\n $js = \"nuMessage(nuTranslate(\'Your password has been successfully changed\'));\";\r\n \r\n}else {\r\n $msg = nuTranslate(\'\"New Password\" must be the same as \"Confirm New Password\"\');\r\n $js = \"nuMessage($msg);\";\r\n}\r\n\r\n\r\nnuJavascriptCallback($js);\r\n\r\n', 'hide', '', '0', '1', '')
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Re: Error occurs when changing user password

Unread post by gerese »

Hi,
updating the database solves the problem of the "CHANGEPASSWORD" procedure.
I tried a clean install of an earlier version and then upgraded to the current one. The "CHANGEPASSWORD" procedure was not copied.
nuBuilderForte .... BIG Like !!!
kev1n
nuBuilder Team
Posts: 4581
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 536 times
Contact:

Re: Error occurs when changing user password

Unread post by kev1n »

This should have been fixed with the latest commit about 2 hours ago.
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Re: Error occurs when changing user password

Unread post by gerese »

Hi,
I tested with the latest downloaded version and it works very well.
Good job :thumb: .
Thanks
nuBuilderForte .... BIG Like !!!
kev1n
nuBuilder Team
Posts: 4581
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 536 times
Contact:

Re: Error occurs when changing user password

Unread post by kev1n »

Thanks for testing :thumb:
Post Reply