Files
desk-moloni/modules/desk_moloni/views/admin/partials/csrf_token.php
Emanuel Almeida c19f6fd9ee fix(perfexcrm module): align version to 3.0.1, unify entrypoint, and harden routes/views
- Bump DESK_MOLONI version to 3.0.1 across module
- Normalize hooks to after_client_* and instantiate PerfexHooks safely
- Fix OAuthController view path and API client class name
- Add missing admin views for webhook config/logs; adjust view loading
- Harden client portal routes and admin routes mapping
- Make Dashboard/Logs/Queue tolerant to optional model methods
- Align log details query with existing schema; avoid broken joins

This makes the module operational in Perfex (admin + client), reduces 404s,
and avoids fatal errors due to inconsistent tables/methods.
2025-09-11 17:38:45 +01:00

51 lines
1.5 KiB
PHP

<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<?php
/**
* CSRF Protection Token Include
*
* Include this file in all forms that need CSRF protection
* Usage: <?php include(module_views_path('desk_moloni', 'admin/partials/csrf_token')); ?>
*
* @package DeskMoloni\Views\Partials
* @version 3.0
*/
// Get CSRF token name and hash
$csrf_token_name = $this->security->get_csrf_token_name();
$csrf_hash = $this->security->get_csrf_hash();
?>
<!-- CSRF Protection Token -->
<input type="hidden" name="<?php echo $csrf_token_name; ?>" value="<?php echo $csrf_hash; ?>" id="csrf_token">
<script>
// Auto-refresh CSRF token for AJAX requests
if (typeof window.deskMoloniCSRF === 'undefined') {
window.deskMoloniCSRF = {
token_name: '<?php echo $csrf_token_name; ?>',
token_value: '<?php echo $csrf_hash; ?>',
// Get current token for AJAX requests
getToken: function() {
return {
name: this.token_name,
value: this.token_value
};
},
// Update token value (called after successful AJAX requests)
updateToken: function(newValue) {
this.token_value = newValue;
document.getElementById('csrf_token').value = newValue;
},
// Add CSRF token to AJAX data
addToData: function(data) {
if (typeof data === 'object') {
data[this.token_name] = this.token_value;
}
return data;
}
};
}
</script>