Skip to content
Snippets Groups Projects
Commit 2ceb39f9 authored by Prasad's avatar Prasad
Browse files

Added cryptmode flag to portalinfo table.

parent 6705ece4
No related branches found
No related tags found
No related merge requests found
......@@ -42,13 +42,13 @@ function Contacts_sendCustomerPortalLoginDetails($entityData){
$password = makeRandomPassword();
$md5_password = md5($password);
if ($insert == true) {
$sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)";
$params = array($entityId, $email, $md5_password, 'C', 1);
$sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,cryptmode,type,isactive) VALUES(?,?,?,?,?)";
$params = array($entityId, $email, $md5_password, 'MD5', 'C', 1);
$adb->pquery($sql, $params);
}
if ($update == true && $portalChanged == true) {
$sql = "UPDATE vtiger_portalinfo SET user_password=? WHERE id=?";
$params = array($md5_password, $entityId);
$sql = "UPDATE vtiger_portalinfo SET user_password=?, cryptmode=? WHERE id=?";
$params = array($md5_password, 'MD5', $entityId);
$adb->pquery($sql, $params);
}
if (($insert == true || ($update = true && $portalChanged == true)) && $entityData->get('emailoptout') == 0) {
......
......@@ -11,14 +11,13 @@
if(defined('VTIGER_UPGRADE')) {
//Start add new currency - 'CFP Franc or Pacific Franc'
global $db;
global $adb;
Vtiger_Utils::AddColumn('vtiger_portalinfo', 'cryptmode', 'varchar(20)');
//Updating existing users password to thier md5 hash
$updateQuery = "UPDATE vtiger_portalinfo SET user_password=MD5(user_password),cryptmode='MD5' WHERE cryptmode is null";
$adb->pquery($updateQuery, array());
$selectQuery = 'SELECT 1 FROM vtiger_portalinfo';
$resultSet = $db->pquery($selectQuery, array());
if ($db->num_rows($resultSet) > 0) {
$updateQuery = 'UPDATE vtiger_portalinfo SET user_password=MD5(user_password)';
$db->pquery($updateQuery, array());
}
}
\ No newline at end of file
......@@ -587,6 +587,7 @@
<field name="user_name" type="C" size="50" />
<field name="user_password" type="C" size="30" />
<field name="type" type="C" size="5" />
<field name="cryptmode" type="C" size="20" />
<field name="last_login_time" type="T" />
<field name="login_time" type="T" />
<field name="logout_time" type="T" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment