- if (!empty($_SESSION['return_path'])) {
- $return_path = $_SESSION['return_path'];
- unset($_SESSION['return_path']);
- } else {
- $return_path = '';
- }
+ Session::setAuthenticatedForUser($a, $record, true, true);
+
+ $return_path = Session::get('return_path', '');
+ Session::remove('return_path');