コード例 #1
0
 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;
     }
 }
コード例 #2
0
ファイル: MemberController.php プロジェクト: block8/octo
 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();
 }
コード例 #3
0
ファイル: TemplateFunctions.php プロジェクト: block8/octo
 public function publicTemplateLoaded(Template &$template)
 {
     $template->member = Member::getInstance();
 }