public function updatePassword($id, $password) { try { $service = ServiceManager::getConnection(DatabaseConstants::DRAGONPHP_DS, DatabaseConstants::USERS_TBL); $criteria = array(); $criteriaData = array(); array_push($criteria, array('field_name' => 'id', 'expression' => '=')); array_push($criteriaData, $id); $service->setCriteria($criteria, $criteriaData); // encrypt password $encryptedPassword = AuthenticationHelper::encryptPasswordMd5($password); $data = array('encrypted_password' => $encryptedPassword); $service->setData($data); $service->update(); return $encryptedPassword; } catch (Exception $ex) { throw new Exception($ex->getMessage()); } }