<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Just to fix a small mistake<div class=""><br class=""></div><div class=""><br class=""></div><div class="">1º Keep remember that you should delete condition /* 'email', 'is not empty’*/ from workflow added in 6.5.0. to 6.6.0 to send email at first creation of contact</div><div class=""><br class=""></div><div class="">2º Still to do - Update inactive in database vtiger_portalinfo when access to portal is disabled (so you can add in the next function to do not send reset password if isactive is ‘0’) because currently, isactive from vtiger_portalinfo is always ‘1'</div><div class=""><br class=""><div class="">3º add reset password in the next function like this</div><div class=""><br class=""></div><div class=""><div class="">function send_mail_for_password($mailid)</div><div class="">{</div><div class=""><span class="Apple-tab-span" style="white-space:pre">  </span>…………...</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>$sql = "select * from vtiger_portalinfo  where user_name = ? ";</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>$res = $adb->pquery($sql, array($mailid));</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>$user_name = $adb->query_result($res,0,'user_name');</div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>- <span class="">// </span>$password = $adb->query_result($res,0,'user_password');</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>+ $password = makeRandomPassword();</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>+ $enc_password = Vtiger_Functions::generateEncryptedPassword($password);</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>$isactive = $adb->query_result($res,0,'isactive');</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span></div><div class=""><span class="Apple-tab-span" style="white-space:pre">  </span>// We no longer have the original password!</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>if (!empty($adb->query_result($res, 0, 'cryptmode'))) {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>- //$password = '*****';</div><div class=""><span class="Apple-tab-span" style="white-space:pre">             </span>+ $sql = "UPDATE vtiger_portalinfo SET user_password=? <b class="">WHERE user_name=?</b>";</div><div class=""><span class="Apple-tab-span" style="white-space:pre">           </span>+ $params = array($enc_password<b class="">, $user_name</b>);</div><div class=""><span class="Apple-tab-span" style="white-space:pre">          </span>+ $adb->pquery($sql, $params);</div><div class=""><span class="Apple-tab-span" style="white-space:pre">            </span>+ $password = $password;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">             </span>// TODO - we need to send link to reset the password</div><div class=""><span class="Apple-tab-span" style="white-space:pre">              </span>// For now CRM user can do the same.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Best Regards.</div><div class=""><br class=""></div><div class="">Manuel</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">No dia 08/10/2016, às 15:55, Manuel Fernando <<a href="mailto:ptdesigner@gmail.com" class="">ptdesigner@gmail.com</a>> escreveu:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello Alan<div class=""><br class=""></div><div class="">Do you think this would be ok for send a reset password for now?</div><div class=""><br class=""></div><div class="">I know that is preferable to send a reset link, but as a quick solution (worst case, people can reset passwords only by putting client email)</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>$sql = "select * from vtiger_portalinfo  where user_name = ? ";</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>$res = $adb->pquery($sql, array($mailid));</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>$user_name = $adb->query_result($res,0,'user_name');</div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span><b class="">// $password = $adb->query_result($res,0,'user_password');</b></div><div class=""><span class="Apple-tab-span" style="white-space:pre">  </span><b class="">$password = makeRandomPassword();</b></div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span><b class="">$enc_password = Vtiger_Functions::generateEncryptedPassword($password);</b></div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>$isactive = $adb->query_result($res,0,'isactive');</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span></div><div class=""><span class="Apple-tab-span" style="white-space:pre">  </span>// We no longer have the original password!</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>if (!empty($adb->query_result($res, 0, 'cryptmode'))) {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span><b class="">// $password = '*****';</b></div><div class=""><b class=""><span class="Apple-tab-span" style="white-space:pre">            </span>$sql = "UPDATE vtiger_portalinfo SET user_password=?";</b></div><div class=""><b class=""><span class="Apple-tab-span" style="white-space:pre">            </span>$params = array($enc_password);</b></div><div class=""><b class=""><span class="Apple-tab-span" style="white-space:pre">             </span>$adb->pquery($sql, $params);</b></div><div class=""><b class=""><span class="Apple-tab-span" style="white-space:pre">             </span>$password = $password;</b></div><div class=""><span class="Apple-tab-span" style="white-space:pre">          </span>// TODO - we need to send link to reset the password</div><div class=""><span class="Apple-tab-span" style="white-space:pre">              </span>// For now CRM user can do the same.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">No dia 29/09/2016, às 11:19, Alan Lord <<a href="mailto:alanslists@gmail.com" class="">alanslists@gmail.com</a>> escreveu:</div><br class="Apple-interchange-newline"><div class=""><div class="">I am testing a migrating for a client from 6.4.0 to 6.5.0 and as they are a heavy Portal user I wanted to make sure that the change to the encrypted passwords works properly.<br class=""><br class="">Everything I have tested with a migrated 6.5.0 and the portal seems to work OK except when I choose the "Forgot Password" option on the portal...<br class=""><br class="">The call gets to vtiger OK but no email is ever sent to the user:<br class=""><br class=""><br class=""><blockquote type="cite" class="">Thu Sep 29 09:56:23 2016,893 [6578] INFO VT - PearDatabase ->ADODB disconnect<br class="">Thu Sep 29 09:56:23 2016,958 [6578] DEBUG VT - Entering customer portal function getPortalUserid<br class="">Thu Sep 29 09:56:23 2016,958 [6578] DEBUG VT - Prepared sql query being executed : SELECT prefvalue FROM vtiger_customerportal_prefs WHERE prefkey = 'userid' AND tabid = 0<br class="">Thu Sep 29 09:56:23 2016,959 [6578] DEBUG user - Entering Users() method ...<br class="">Thu Sep 29 09:56:23 2016,959 [6578] DEBUG VT - Entering getColumnFields(Users) method ...<br class="">Thu Sep 29 09:56:23 2016,959 [6578] DEBUG VT - in getColumnFields Users<br class="">Thu Sep 29 09:56:23 2016,959 [6578] DEBUG VT - Prepared sql query being executed : SELECT tabid, name, ownedby FROM vtiger_tab<br class="">Thu Sep 29 09:56:23 2016,964 [6578] DEBUG VT - Prepared sql query being executed : SELECT tabid, fieldname, fieldid, fieldlabel, columnname, tablename, uitype, typeofdata, presence<br class="">                FROM vtiger_field WHERE tabid in (?)<br class="">Thu Sep 29 09:56:23 2016,964 [6578] DEBUG VT - Prepared sql query parameters : [29]<br class="">Thu Sep 29 09:56:23 2016,975 [6578] DEBUG VT - Exiting getColumnFields method ...<br class="">Thu Sep 29 09:56:23 2016,975 [6578] DEBUG user - Exiting Users() method ...<br class="">Thu Sep 29 09:56:23 2016,978 [6578] DEBUG customerportal - Entering customer portal function send_mail_for_password<br class="">Thu Sep 29 09:56:23 2016,978 [6578] INFO VT - PearDatabase ->Inside the function send_mail_for_password(<a href="mailto:alan@hidden.co.uk" class="">alan@hidden.co.uk</a>).<br class="">Thu Sep 29 09:56:23 2016,979 [6578] DEBUG customerportal - Prepared sql query being executed : select * from vtiger_portalinfo  where user_name = ?<br class="">Thu Sep 29 09:56:23 2016,979 [6578] DEBUG customerportal - Prepared sql query parameters : [<a href="mailto:alan@hidden.co.uk" class="">alan@hidden.co.uk</a>]<br class="">Thu Sep 29 09:56:23 2016,979 [6578] DEBUG customerportal - Prepared sql query being executed : select vtiger_users.user_name, vtiger_users.email1 from vtiger_users inner join vtiger_crmentity on vtiger_users.id = vtiger_crmentity.smownerid inner join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_crmentity.crmid where vtiger_contactdetails.email =?<br class="">Thu Sep 29 09:56:23 2016,980 [6578] DEBUG customerportal - Prepared sql query parameters : [<a href="mailto:alan@hidden.co.uk" class="">alan@hidden.co.uk</a>]<br class="">Thu Sep 29 09:56:23 2016,983 [6578] DEBUG customerportal - Prepared sql query being executed : SELECT * FROM vtiger_tab<br class="">Thu Sep 29 09:56:24 2016,002 [6578] DEBUG customerportal - Prepared sql query being executed : SELECT fieldname,modulename,tablename,entityidfield,entityidcolumn from vtiger_entityname<br class="">Thu Sep 29 09:56:24 2016,007 [6578] DEBUG customerportal - Prepared sql query being executed : select * from vtiger_systems where server_type=?<br class="">Thu Sep 29 09:56:24 2016,007 [6578] DEBUG customerportal - Prepared sql query parameters : [email]<br class="">Thu Sep 29 09:56:24 2016,044 [6578] INFO VT - PearDatabase ->Exit from send_mail_for_password. false@@@<b></b><br class="">Thu Sep 29 09:56:24 2016,044 [6578] DEBUG customerportal - Exiting customer portal function send_mail_for_password<br class=""></blockquote><br class="">In the function above I see the comment:<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>// We no longer have the original password!<br class=""><span class="Apple-tab-span" style="white-space:pre">    </span>if (!empty($adb->query_result($res, 0, 'cryptmode'))) {<br class=""><span class="Apple-tab-span" style="white-space:pre">     </span><span class="Apple-tab-span" style="white-space:pre">    </span>$password = '*****';<br class=""><span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span>// TODO - we need to send link to reset the password<br class=""><span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span>// For now CRM user can do the same.<br class=""><span class="Apple-tab-span" style="white-space:pre">   </span>}<br class=""></blockquote><br class="">I see a glaring issue with this function in that it uses $mod_strings... As far as I can tell this is *non-existent* in vtiger 6.<br class=""><br class="">The queries seem to me to be trying to create an email which would be sent to the Contact's Assigned User? But on my system it never gets sent, but because of the $mod_strings issue I have no idea which error was trapped.<br class=""><br class="">Has anyone tested this before?<br class=""><br class="">Thanks<br class=""><br class="">Al<br class=""><br class=""><br class="">What is this function supposed to do?<br class=""><br class=""><br class=""><br class=""><br class="">_______________________________________________<br class=""><a href="http://www.vtiger.com/" class="">http://www.vtiger.com/</a><br class=""></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></body></html>