public function index() { if (!empty(AuthenticationHandler::$data)) { Go::to('a'); } $f = new Form('search'); $this->addForm('search', $f); $this->setTitle('Savely.co'); $this->addScript('Dabox'); $this->addScript('Request'); $this->addScript('StageChart'); $form_register = new Form('register'); if ($form_register->isValid()) { $values = $form_register->getValues(); } $this->addForm('register', $form_register); $form = new Form('login'); if ($form->isValid()) { $values = $form->getValues(); if (AuthenticationHandler::setUserSession($values['login'], $values['password'])) { Go::to('a'); } else { $this->addContent('login_error', Dictionary::term('login.error.unknown_user')); } } $m = new ModelLink(); $all = $m->retrieveLinksHome(); $this->addContent('products', $all); $this->addForm('login', $form); }
function __construct() { AuthenticationHandler::getInstance(); if (!AuthenticationHandler::$data) { Go::to(); } $this->addScript('ShopLater'); $f = new Form('search'); $this->addForm('search', $f); $f = new Form('addEntry'); $this->addForm('addUrl', $f); $m = new ModelList(); $this->addContent('user_lists', $m->retrieveByUser(AuthenticationHandler::$data['id_user'], 5)); }
public function password() { $this->setTitle('Change your password - Savely.co'); $f = new Form('password'); if ($f->isValid()) { $v = $f->getValues(); if (ModelAuthentication::getInstance()->changePassword($v['currentPassword'], $v['newPassword'])) { AuthenticationHandler::unsetUserSession(); AuthenticationHandler::setUserSession(ModelAuthentication::getInstance()->getLogin(), $v['newPassword']); $this->addContent('confirmation', 'New Password Saved'); } else { $this->addContent('error', 'You current password does not match'); } } else { $this->addContent('error', $f->getError()); } $this->addForm('password', $f); }
public static function isLoggedToBack() { return AuthenticationHandler::is(AuthenticationHandler::ADMIN); }