protected function formIsValid(Form $form, $vars)
 {
     if (!$form->hasBeenValidated()) {
         $form->validate($vars);
     }
     return $form->isValid();
 }
 function stepOne()
 {
     $widget = $this->getWidget();
     $f = new Forms\Form('post');
     $f->addSection('step-one', array(Forms\newBasicTextField('title', 'Title'), Forms\newDollarAmountField('goal', 'Goal')->minAmount(0.001)->maxAmount(self::maxGoal, "Sorry, at the present time " . self::maxGoal . " is the maximum allowed goal."), Forms\newDateField('ending', 'End Date')->nameForValidation("Ending Date field"), Forms\newBasicTextField('bitcoinAddress', 'Bitcoin Address')));
     if ($this->isPostRequestAndFormIsValid($f)) {
         foreach (array('title', 'ending', 'bitcoinAddress') as $v) {
             $widget->{$v} = $_POST[$v];
         }
         $widget->setGoal($_POST['goal'], $_POST['currency']);
         $widget->uriID = URL\titleToUrlComponent($widget->title);
         if (at($_POST, 'save-and-return')) {
             $widget->save();
             return $this->redirect('/dashboard/');
         } else {
             $this->storeWidgetInSession($widget);
             return $this->redirect('/widget-wiz/step-two');
         }
     } else {
         return $this->renderStep('step-one.php', $widget, $f);
     }
 }
 function changePassword()
 {
     $user = $this->user;
     $form = new F\Form('post');
     $passwordField = F\newPasswordField('password', 'Password');
     $confirmPassField = new PasswordConfirmField('confirm-password', 'Re-enter password');
     $form->addSection('change-password', array(F\newPasswordField('current-password', 'Current Password')->required('Please authenticate by entering your current password.')->addValidation(function ($pass) use($user) {
         return Passwords\isValid($pass, $user->passwordEncrypted) ? array() : array("Your current password is incorrect!");
     }), $passwordField->addValidation(function ($pass) {
         return strlen($pass) < 5 ? array('Password must be at least five (5) characters long.') : array();
     }), $confirmPassField->required('Please confirm the password by entering it a second time.')));
     $success = false;
     if ($this->isPostRequestAndFormIsValid($form)) {
         $hashedPass = Passwords\hash($form->getValue("password"));
         $user->updatePassword($hashedPass);
         $success = true;
     }
     return $this->render('account/change-password.php', array('form' => $form, 'success' => $success, 'newPassword' => $this->takeFromSession('newPassword')));
 }
    function innerContent()
    {
        ?>

    <?php 
        echo $this->validationJavascript();
        ?>

    <div id="box_sign">
      <div class="container">
        <div class="span12 box_wrapper">
          <div class="span12 box">
            <div class="head">
              <div class="bitcoinchipin-logo">
                <img src="<?php 
        echo PATH;
        ?>
img/logo.jpg" alt="Bitcoin Chipin" />
              </div>
              <h4>Let's get you an account</h4>
            </div>
            <div class="form">
              <form id="signup-form" action="<?php 
        echo PATH;
        ?>
account/signup" method="post"
                    onsubmit="return validateForm();">
                <?php 
        if ($this->form->hasErrors()) {
            ?>
                  <div id="form-error" class="alert alert-error">
                    <a class="close" data-dismiss="alert" href="#">×</a>
                    <h4 class="alert-heading">Error!</h4>
                    <?php 
            echo current($this->form->getErrors());
            ?>
                  </div>
                <?php 
        }
        ?>
                <div id="password-error" class="alert alert-error" style="display: none;">
                  <a class="close" data-dismiss="alert" href="#">×</a>
                  <h4 class="alert-heading">Error!</h4>
                  Passwords don't match.
                </div>
                <div id="username-error" class="alert alert-error" style="display: none;">
                  <a class="close" data-dismiss="alert" href="#">×</a>
                  <h4 class="alert-heading">Error!</h4>
                  You must provide a username!
                </div>
                <?php 
        /* if (isset($this->captchaIncorrect) && $this->captchaIncorrect): ?>
             <div class="alert alert-error">
               <a class="close" data-dismiss="alert" href="#">×</a>
               <h4 class="alert-heading">Error!</h4>
               Captcha code incorrectly identified. Please try again!
             </div>
           <?php endif; */
        ?>
                <div class="account-fields">
                  <div class="field">
                    <label for="username">Username:</label>
                    <input type="text" id="username" name="username" value=""
                          placeholder="Username" class="login" />
                  </div> <!-- /field -->
                  <div class="field">
                    <label for="email">Email Address:</label>
                    <input type="text" id="email" name="email" value="" placeholder="Email" class="login"/>
                  </div> <!-- /field -->
                  <div class="field">
                    <label for="password">Password:</label>
                    <input type="password" id="password" name="password1" value=""
                          placeholder="Password" class="login"/>
                  </div> <!-- /field -->
                  <div class="field">
                    <label for="confirm_password">Confirm Password:</label>
                    <input type="password" id="confirm_password" name="password2" value=""
                          placeholder="Confirm Password" class="login"/>
                  </div> <!-- /field -->
                  <?php 
        /* <div class="field captcha-field">
             <?= $this->captcha->render() ?>
             <input type="hidden" name="captcha-id" id="captcha-id"
                   value="<?= $this->captcha->getId() ?>" />
             <input type="text" name="captcha-input" id="captcha-input" value=""
                   placeholder="Captcha">
             <div style="clear: both;"> </div>
           </div> */
        ?>
                  <div class="field newsletter-options">
                    <label for="chipin-updates">
                      <input type="checkbox" id="chipin-updates" name="chipin-updates" />
                      Receive news updates from BitcoinChipin.com
                    </label>
                    <label for="memorydealers-updates">
                      <input type="checkbox" id="memorydealers-updates"
                             name="memorydealers-updates" />
                      Receive news updates from MemoryDealers.com
                    </label>
                  </div>
                </div> <!-- /account-fields -->
                <div class="login-actions">
                  <?php 
        /* <span class="login-checkbox" style="display: none;">
             <input id="Field" name="Field" type="checkbox" class="field login-checkbox"
                   value="First Choice" tabindex="4" />
             <label class="choice" for="Field">I have read and agree with the Terms of Use.</label>
           </span> */
        ?>
                  <!-- <button class="button btn btn-primary btn-large">Register</button> -->
                  <input type="submit" class="btn btn-large" value="Register" />
                </div> <!-- /.login-actions -->
              </form>
            </div> <!-- /.form -->
          </div> <!-- /.box -->

          <p class="already login-extra">
            Already have an account? <a href="<?php 
        echo PATH;
        ?>
account/signin">Sign in here.</a>
          </p>

        </div> <!-- /.box_wrapper -->
      </div> <!-- /.container -->
    </div> <!-- /#box_sign -->

  <?php 
    }