CRM_Core_Error::statusBounce(ts("Access denied"), CRM_Utils_System::url('civicrm'));
}
else {
- CRM_Utils_System::redirect('/civicrm/login?anonAccessDenied');
- }
+ http_response_code(403);
+
+ // render a login page
+ if (class_exists('CRM_Standaloneusers_Page_Login')) {
+ $loginPage = new CRM_Standaloneusers_Page_Login();
+ $loginPage->assign('anonAccessDenied', TRUE);
+ return $loginPage->run();
+ }
- // TODO: Prettier error page
+ throw new CRM_Core_Exception('Access denied. Standaloneusers extension not found');
+ }
}
+ /**
+ * Start a new session.
+ */
+ public function sessionStart() {
+ $session_handler = new SessionHandler();
+ session_set_save_handler($session_handler);
+
+ $session_max_lifetime = Civi::settings()->get('standaloneusers_session_max_lifetime') ?? 1440;
+
+ session_start([
+ 'cookie_httponly' => 1,
+ 'cookie_secure' => !empty($_SERVER['HTTPS']),
+ 'gc_maxlifetime' => $session_max_lifetime,
+ 'name' => 'SESSCIVISO',
+ 'use_cookies' => 1,
+ 'use_only_cookies' => 1,
+ 'use_strict_mode' => 1,
+ ]);
+ }
+
}
SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE IF EXISTS `civicrm_user_role`;
DROP TABLE IF EXISTS `civicrm_uf_match`;
+ DROP TABLE IF EXISTS `civicrm_session`;
DROP TABLE IF EXISTS `civicrm_role`;
SET FOREIGN_KEY_CHECKS=1;
SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE IF EXISTS `civicrm_user_role`;
DROP TABLE IF EXISTS `civicrm_uf_match`;
+ DROP TABLE IF EXISTS `civicrm_session`;
DROP TABLE IF EXISTS `civicrm_role`;
SET FOREIGN_KEY_CHECKS=1;