Beispiel #1
0
  function POST() {
    $P = new Password();
    $data['pass_exists'] = $P->passExists();

    if($data['pass_exists'] && !$P->isValid($_POST['password'])) {
      $this->layout_vars = array(
        'content' => "The password you entered is incorrect.");

      return;
    }

    if($_POST['newpass'] != $_POST['passconfirm']) {
      $data['confirm_failed'] = true;
      $this->layout_vars = array(
        'content' => new View('admin/setpw', $data));
      return;
    }

    if($P->setPassword($_POST['newpass'])) {
      $this->layout_vars = array(
        'content' => "Password set successfully. <a href=\"".site_page('admin/')."\">Go to index</a>");
    } else {
      $this->layout_vars = array(
        'content' => "Couldn't create the password file. Y'all need to check permissions.");
    }
  }