public function publicTemplateFunctions(Template &$template) { $template->now = new DateTime(); $template->config = Config::getInstance(); $template->member = Member::getInstance(); if (isset($_SESSION) && is_array($_SESSION)) { $template->session = $_SESSION; } }
public function resetPassword($memberId) { $view = new Template('Member/forgot-password'); $member = Store::get('Contact')->getById($memberId); $key = $this->getParam('k', null); if (is_null($member) || $key != $this->getResetKey($member)) { $this->response->setResponseCode(401); $view->errorMessage = 'Invalid password reset request.'; return $view->render(); } $view->text = '<strong>Please enter a new password below.</strong><br><br>'; $view->form = $this->resetPasswordForm($memberId, $key); if ($this->request->getMethod() == 'POST') { $member->setPasswordHash(password_hash($this->getParam('password'), PASSWORD_DEFAULT)); Store::get('Contact')->save($member); Member::getInstance()->login($member); $this->response->setResponseCode(302); $this->response->setHeader('Location', $this->config->get('site.url')); return; } return $view->render(); }
public function publicTemplateLoaded(Template &$template) { $template->member = Member::getInstance(); }