public function execute(array $matches, $url, $rest) { $tmpl = new Template('admin/config'); $normalizer = new ConfigNormalizer(); $cfg = new CFG(); if (Admin::needsSetup()) { $tmpl->render(['currency' => $cfg->getCurrencyCode(), 'config' => $normalizer->denormalize(new CFG()), 'password' => '']); return true; } header('Location: /admin/login?error=1'); header('HTTP/1.1 401 Unauthorized'); return false; }
public function execute(array $matches, $url, $rest) { $post = Container::dispense('Environment\\Post'); $password = $post['password']; $normalizer = new ConfigNormalizer(); $admin = new Admin(); $tmpl = new Template('admin/config'); $cfg = new CFG(); if ($admin->auth($password)) { $tmpl->render(['currency' => $cfg->getCurrencyCode(), 'password' => $password, 'config' => $normalizer->denormalize($admin->getConfig())]); return true; } header('HTTP/1.1 303 See Other'); if (empty($post['alt'])) { header('Location: /admin/login?error=1'); } else { if ($post['alt'] === 'email') { header('Location: /admin/email?error=1'); } else { header('Location: /admin/minimum-balance?error=1'); } } return false; }