/** * Execute the extra. * * @return void */ public function execute() { // logout if (FrontendProfilesAuthentication::isLoggedIn()) { FrontendProfilesAuthentication::logout(); } // trigger event FrontendModel::triggerEvent('profiles', 'after_logout'); // redirect $this->redirect(SITE_URL); }
/** * Parse */ private function parse() { $this->tpl->assign('isLoggedIn', FrontendProfilesAuthentication::isLoggedIn()); if (FrontendProfilesAuthentication::isLoggedIn()) { // get the profile /** * @var FrontendProfilesProfile */ $profile = FrontendProfilesAuthentication::getProfile(); $this->tpl->assign('profile', $profile->toArray()); } }
/** * Execute. */ public function execute() { parent::execute(); // profile not logged in if (!FrontendProfilesAuthentication::isLoggedIn()) { $this->loadTemplate(); $this->loadForm(); $this->validateForm(); $this->parse(); } else { $this->redirect(SITE_URL); } }
/** * Execute the extra. */ public function execute() { // only for guests if (!FrontendProfilesAuthentication::isLoggedIn()) { parent::execute(); $this->loadTemplate(); $this->loadForm(); $this->validateForm(); $this->parse(); } else { $this->redirect(FrontendNavigation::getURLForBlock('profiles', 'settings')); } }
/** * Execute the extra. */ public function execute() { // profile logged in if (FrontendProfilesAuthentication::isLoggedIn()) { parent::execute(); $this->getData(); $this->loadTemplate(); $this->loadForm(); $this->validateForm(); $this->parse(); } else { $this->redirect(FrontendNavigation::getURL(404)); } }
/** * Execute the extra. * * @return void */ public function execute() { // no url parameter if (FrontendProfilesAuthentication::isLoggedIn()) { // call the parent parent::execute(); /* * You could use this as some kind of dashboard where you could show an activity stream, some statistics, ... */ // load template $this->loadTemplate(); } else { $this->redirect(FrontendNavigation::getURL(404)); } }
/** * Execute the extra. */ public function execute() { // only logged in profiles can seer their dashboard if (FrontendProfilesAuthentication::isLoggedIn()) { // call the parent parent::execute(); /* * You could use this as some kind of dashboard where you can show an activity * stream, some statistics, ... */ $this->loadTemplate(); } else { $this->redirect(FrontendNavigation::getURL(404)); } }
/** * Execute the extra * * @return void */ public function execute() { // profile not logged in if (!FrontendProfilesAuthentication::isLoggedIn()) { // load parent parent::execute(); // load template $this->loadTemplate(); // load $this->loadForm(); // validate $this->validateForm(); // parse $this->parse(); } else { $this->redirect(FrontendNavigation::getURL(404)); } }
/** * Execute the extra. * * @return void */ public function execute() { // load parent parent::execute(); // load template $this->loadTemplate(); // profile not logged in if (!FrontendProfilesAuthentication::isLoggedIn()) { // load $this->loadForm(); // validate $this->validateForm(); // parse $this->parse(); } elseif ($this->URL->getParameter('sent') == true) { $this->parse(); } else { $this->redirect(SITE_URL); } }
/** * Parse the general profiles info into the template. */ public static function parse() { // get the template $tpl = Spoon::get('template'); // logged in if (FrontendProfilesAuthentication::isLoggedIn()) { // get profile $profile = FrontendProfilesAuthentication::getProfile(); // display name set? if ($profile->getDisplayName() != '') { $tpl->assign('profileDisplayName', $profile->getDisplayName()); } else { $tpl->assign('profileDisplayName', $profile->getEmail()); } // show logged in $tpl->assign('isLoggedIn', true); } // ignore these url's in the querystring $ignoreUrls = array(FrontendNavigation::getURLForBlock('profiles', 'login'), FrontendNavigation::getURLForBlock('profiles', 'register'), FrontendNavigation::getURLForBlock('profiles', 'forgot_password')); // querystring $queryString = isset($_GET['queryString']) ? SITE_URL . '/' . urldecode($_GET['queryString']) : SELF; // check all ignore urls foreach ($ignoreUrls as $url) { // querystring contains a boeboe url if (stripos($queryString, $url) !== false) { $queryString = ''; break; } } // no need to add this if its empty $queryString = $queryString != '' ? '?queryString=' . urlencode($queryString) : ''; // useful urls $tpl->assign('loginUrl', FrontendNavigation::getURLForBlock('profiles', 'login') . $queryString); $tpl->assign('registerUrl', FrontendNavigation::getURLForBlock('profiles', 'register')); $tpl->assign('forgotPasswordUrl', FrontendNavigation::getURLForBlock('profiles', 'forgot_password')); }
/** * Validate the form. * * @return void */ private function validateForm() { // is the form submitted if ($this->frm->isSubmitted()) { // get fields $txtPassword = $this->frm->getField('password'); // field is filled in? $txtPassword->isFilled(FL::getError('PasswordIsRequired')); // valid if ($this->frm->isCorrect()) { // get profile id $profileId = FrontendProfilesModel::getIdBySetting('forgot_password_key', $this->URL->getParameter(0)); // remove key (we can only update the password once with this key) FrontendProfilesModel::deleteSetting($profileId, 'forgot_password_key'); // update password FrontendProfilesAuthentication::updatePassword($profileId, $txtPassword->getValue()); // login (check again because we might have logged in in the meanwhile) if (!FrontendProfilesAuthentication::isLoggedIn()) { FrontendProfilesAuthentication::login($profileId); } // trigger event FrontendModel::triggerEvent('profiles', 'after_reset_password', array('id' => $profileId)); // redirect $this->redirect(FrontendNavigation::getURLForBlock('profiles', 'reset_password') . '/' . $this->URL->getParameter(0) . '?saved=true'); } else { $this->tpl->assign('forgotPasswordHasError', true); } } }