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; }
/** * User update. * * @param int $id * @return View */ public function getEdit($id = null) { try { // Get the user information $user = Sentry::getUserProvider()->findById($id); // Get this user groups $userGroups = $user->groups()->lists('name', 'group_id'); // Get this user permissions $userPermissions = array_merge(Input::old('permissions', array('superuser' => -1)), $user->getPermissions()); $this->encodePermissions($userPermissions); // Get a list of all the available groups $groups = Sentry::getGroupProvider()->findAll(); // Get all the available permissions $permissions = Config::get('permissions'); $this->encodeAllPermissions($permissions); } catch (UserNotFoundException $e) { // Prepare the error message $error = Lang::get('admin/users/message.user_not_found', compact('id')); // Redirect to the user management page return Redirect::route('users')->with('error', $error); } // Show the page return View::make('backend/users/edit', compact('user', 'groups', 'userGroups', 'permissions', 'userPermissions')); }