public function on_start() { $u = new \User(); if (!$u->isRegistered()) { return $this->replace('/login'); } $dh = \Core::make('helper/concrete/dashboard'); $desktop = DesktopList::getMyDesktop(); if ($dh->inDashboard($desktop) && $this->getPageObject()->getCollectionPath() != '/account/welcome') { $this->theme = 'dashboard'; $this->set('pageTitle', t('My Account')); } $this->setThemeViewTemplate('account.php'); $this->error = Loader::helper('validation/error'); $this->token = Loader::helper('validation/token'); $this->set('valt', $this->token); $this->set('av', Loader::helper('concrete/avatar')); $this->set('profile', \UserInfo::getByID($u->getUserID())); $nav = new AccountMenu($this->getPageObject()); $this->set('nav', $nav); }
public function chooseRedirect() { $config = $this->app->make('config'); $session = $this->app->make('session'); if (!$this->error) { $this->error = $this->app->make('helper/validation/error'); } $nh = $this->app->make('helper/validation/numbers'); $navigation = $this->app->make('helper/navigation'); $rUrl = false; $u = new User(); // added for the required registration attribute change above. We recalc the user and make sure they're still logged in if ($u->isRegistered()) { if ($u->config('NEWSFLOW_LAST_VIEWED') == 'FIRSTRUN') { $u->saveConfig('NEWSFLOW_LAST_VIEWED', 0); } do { // redirect to original destination if ($session->has('rUri')) { $rUrl = $session->get('rUri'); $session->remove('rUri'); if ($rUrl) { break; } } if ($session->has('rcID')) { $rcID = $session->get('rcID'); if ($nh->integer($rcID)) { $rc = Page::getByID($rcID); } elseif (strlen($rcID)) { $rcID = trim($rcID, '/'); $rc = Page::getByPath('/' . $rcID); } if ($rc instanceof Page && !$rc->isError()) { $rUrl = $navigation->getLinkToCollection($rc); break; } } $login_redirect_mode = $config->get('concrete.misc.login_redirect'); //redirect to custom page $login_redirect_cid = intval($config->get('concrete.misc.login_redirect_cid')); if ($login_redirect_mode == 'CUSTOM' && $login_redirect_cid > 0) { $rc = Page::getByID($login_redirect_cid); if ($rc instanceof Page && !$rc->isError()) { $rUrl = $navigation->getLinkToCollection($rc); break; } } if ($login_redirect_mode == 'DESKTOP') { $desktop = DesktopList::getMyDesktop(); if (is_object($desktop)) { $rUrl = $navigation->getLinkToCollection($desktop); } } break; } while (false); if ($rUrl) { return new RedirectResponse($rUrl); } else { return Redirect::to('/'); } } else { $this->error->add(t('User is not registered. Check your authentication controller.')); $u->logout(); } }
<?php defined('C5_EXECUTE') or die("Access Denied."); do { $u = new User(); if (!$u->isRegistered()) { break; } $ui = $u->getUserInfoObject(); $account = Page::getByPath('/account'); if (!is_object($account) || $account->isError()) { break; } $desktop = \Concrete\Core\Page\Desktop\DesktopList::getMyDesktop(); if (!is_object($desktop) || $desktop->isError()) { break; } $cp = new Permissions($desktop); if (!$cp->canRead()) { break; } ?> <div style="display: none"> <div class="btn-group" id="ccm-account-menu"> <a class="btn btn-default" href="<?php echo $desktop->getCollectionLink(); ?> "><i class="fa fa-user"></i> <?php echo $ui->getUserDisplayName(); ?>