public function run() { $config = new Config(); $this->write("Upgrading " . $config->siteTitle() . " . . . "); $db = new Db(); $db->install(); $this->write("Upgrade complete"); }
public function remind(Request $request, Response $response, array $args) { $name = $request->get('name'); if ($request->get('login')) { return new RedirectResponse($this->config->baseUrl() . '/login?name=' . $name); } $config = new Config(); $user = new User($this->db); $user->loadByName($name); $template = new Template('remind_email.twig'); if (!empty($user->getEmail())) { $template->user = $user; $template->token = $user->getReminder(); $message = \Swift_Message::newInstance()->setSubject('Password reminder')->setFrom(array($config->siteEmail() => $config->siteTitle()))->setTo(array($user->getEmail() => $user->getName()))->setBody($template->render(), 'text/html'); $this->email($message); } else { // Pause for a moment, so it's not so obvious which users' names are resulting in mail being sent. sleep(5); } $template->alert('success', 'Please check your email', true); return new RedirectResponse($this->config->baseUrl() . '/remind?name=' . $name); }