An inconsistency was observed when trying to reset the password using the "app_retrieve_pswd" application.
The correction was made for new modules, created from release 9.10.001.
For modules created in previous releases that use this option, we must make a small change to the app_retrieve_pswd application code, check out the tutorial below.
This tutorial covers security modules created before release 9.10.001 and that use the Send email with a link to generate new password option
1- Open the app_retrieve_pswd application
By default, the prefix of security applications is app_ and the "security" folder, so, with scriptcase open, it is possible to locate the application:
The prefix and folder may have been changed during module generation.
2- Access the send_act method
Access the Programming block, in the PHP Methods folder select the send_act method.
3- Add the code
In old modules, the code for this event looks like this:
- $act_code = act_code();
- $sql = "UPDATE
- sec_1users
- SET
- activation_code = '". $act_code ."'
- WHERE
- login = '". [usr_login] ."'";
- sc_exec_sql($sql);
- send_mail_message({lang_send_act_code}
- . "<br/> <a href='http://". $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']. "?act_code=" . $act_code ."'> http://".$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']. "?act_code=" . $act_code ." </a>");
Below $act_code = act_code(); add the following code: $act_code = substr($act_code, 0, 32);
The code should look like this:
- $act_code = act_code();
- $act_code = substr($act_code, 0, 32);
- $sql = "UPDATE
- sec_1users
- SET
- activation_code = '". $act_code ."'
- WHERE
- login = '". [usr_login] ."'";
- sc_exec_sql($sql);
- send_mail_message({lang_send_act_code}
- . "<br/> <a href='http://". $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']. "?act_code=" . $act_code ."'> http://".$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']. "?act_code=" . $act_code ." </a>");