getByUsername($data['USR_USERNAME']); $userExists = $userData === false ? false : true; if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL'] && ($userData['USR_AUTH_TYPE'] === '' || $userData['USR_AUTH_TYPE'] == 'MYSQL')) { $aSetup = System::getEmailConfiguration(); if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) { G::SendTemporalMessage('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning"); G::header('location: forgotPassword'); die; } $newPass = G::generate_password(); $aData['USR_UID'] = $userData['USR_UID']; $aData['USR_PASSWORD'] = Bootstrap::hashPassword($newPass); $oUserProperty = new UsersProperties(); $aUserPropertyData = $oUserProperty->load($aData['USR_UID']); if (is_array($aUserPropertyData)) { $aUserPropertyData['USR_LOGGED_NEXT_TIME'] = 1; $oUserProperty = $oUserProperty->update($aUserPropertyData); } if (!isset($sFrom)) { $sFrom = ''; } $sFrom = G::buildFrom($aSetup, $sFrom); $sSubject = G::LoadTranslation('ID_RESET_PASSWORD') . ' - ProcessMaker'; $msg = '

ProcessMaker Forgot password Service

'; $msg .= '

' . G::LoadTranslation('ID_YOUR_USERMANE_IS') . ' : ' . $userData['USR_USERNAME'] . '

'; $msg .= '

' . G::LoadTranslation('ID_YOUR_PASSWORD_IS') . ' : ' . $newPass . '

'; switch ($aSetup['MESS_ENGINE']) { case 'MAIL': $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1'); break; case 'PHPMAILER': $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2'); break; case 'OPENMAIL': $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3'); break; } $sBody = "
$msg


This Business Process is powered by ProcessMaker ver. " . System::getVersion() . ".
www.processmaker.com
"; $oSpool = new SpoolRun(); $oSpool->setConfig($aSetup); $oSpool->create(array( 'msg_uid' => '', 'app_uid' => '', 'del_index' => 0, 'app_msg_type' => 'TEST', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $data['USR_EMAIL'], 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending', 'app_msg_attach' => '' )); try { $oSpool->sendMail(); $rbacUser->update($aData); $user->update($aData); G::header("location: login"); G::SendTemporalMessage('ID_NEW_PASSWORD_SENT', "info"); } catch (phpmailerException $e) { G::header("location: login"); G::SendTemporalMessage(G::LoadTranslation('MISSING_OR_NOT_CONFIGURED_SMTP'), "warning", 'string'); } catch (Exception $e) { G::header("location: login"); G::SendTemporalMessage($e->getMessage(), "warning", 'string'); } } else { if ($userExists === true || $userData['USR_AUTH_TYPE'] === '' || $userData['USR_AUTH_TYPE'] === 'MYSQL') { $msg = G::LoadTranslation('ID_USER') . ' ' . htmlentities($data['USR_USERNAME'], ENT_QUOTES, 'UTF-8') . ' ' . G::LoadTranslation('ID_IS_NOT_REGISTERED'); } else { if ($userExists === false) { $msg = G::LoadTranslation('ID_THE_USERNAME_EMAIL_IS_INCORRECT'); } else { $msg = G::LoadTranslation('ID_USER_NOT_FUNCTIONALITY'); } } G::SendTemporalMessage($msg, "warning", 'string'); G::header('location: forgotPassword'); }