public function forgot() { $this->setLayout(array('header' => false, 'body' => array('theme' => 'wallpaper'))); if ($this->request->isPost()) { if (isset($this->request->data['User']['password'])) { $user = new User(); $response = $user->forgotNewPassword($this->data); if (isset($response['errors']) && is_array($response['errors']) && count($response['errors']) > 0) { foreach ($response['errors'] as $field => $error) { $this->Session->setFlash(__d('paszport', $error, true), null, array('class' => 'alert-danger')); } } elseif (isset($response['success']) && $response['success']) { $this->set('tokenSuccess', true); $this->set('newPasswordSuccess', true); } else { throw new BadRequestException(); } } else { $user = new User(); $response = $user->forgot($this->data); if (isset($response['errors']) && is_array($response['errors']) && count($response['errors']) > 0) { foreach ($response['errors'] as $field => $error) { $this->Session->setFlash(__d('paszport', $error, true), null, array('class' => 'alert-danger')); } } elseif (isset($response['success']) && $response['success']) { $this->set('success', true); } else { throw new BadRequestException(); } } } else { if (isset($this->request->query['token'])) { $user = new User(); $response = $user->forgotToken(array('token' => $this->request->query['token'])); if (isset($response['errors']) && is_array($response['errors']) && count($response['errors']) > 0) { foreach ($response['errors'] as $field => $error) { $this->Session->setFlash(__d('paszport', $error, true), null, array('class' => 'alert-danger')); } } elseif (isset($response['success']) && $response['success']) { $this->set('token', $this->request->query['token']); $this->set('tokenSuccess', true); } else { throw new BadRequestException(); } } } }
<?php require_once './includes/loader.php'; $sAction = $_GET['action']; if (!empty($sUser)) { header("Location: main.php"); die; } if ($sAction == forgot) { $sErrors[] = User::forgot($_POST['email']); } echo Templater::AdvancedParse($sTemplate->sValue . '/forgot', $locale->strings, array("Errors" => $sErrors));