Esempio n. 1
1
 public function _createForgotPassForm()
 {
     $form = new Form();
     $form->action = "/forgotpass";
     $form->add(EmailField::name('email')->label('Email')->help('What is your email address?')->required(true));
     return $form;
 }
Esempio n. 2
0
 /**
  * @param User $user
  * @return Form
  */
 private function _createProfileEditForm($user)
 {
     $form = new Form();
     $form->add(DisplayField::name('username')->label("Username")->value($user->get('username')));
     $form->add(EmailField::name('email')->label("Email")->value($user->get('email'))->required(true));
     if (User::$me->isAdmin()) {
         $form->add(CheckboxField::name('admin')->label("Is admin?")->help("Is this user an admin?")->checked($user->isAdmin()));
     }
     // todo add DateField
     /**
     $form->add(
     	DateField::name('birthday')
     		->label("Birthday")
     		->value($user->get('birthday'))
     );
     */
     $password_page = $user->getUrl() . "/changepass";
     $form->add(DisplayField::name('changepass')->label("Change Password")->value("Please visit the <a href=\"{$password_page}\">change password</a> page."));
     return $form;
 }
Esempio n. 3
0
 public function _createRegisterForm()
 {
     $form = new Form('register');
     if (!$this->args('username')) {
         $username = '';
     } else {
         $username = $this->args('username');
     }
     if (!$this->args('email')) {
         $email = '';
     } else {
         $email = $this->args('email');
     }
     $form->add(TextField::name('username')->label("Username")->value($username)->required(true));
     $form->add(EmailField::name('email')->label("Email address")->value($email)->required(true));
     $form->add(PasswordField::name('pass1')->label("Password")->required(true));
     $form->add(PasswordField::name('pass2')->label("Password Confirmation")->required(true));
     $tos = "By clicking on the \"Create your account\" button below, you certify that you have read and agree to our ";
     $tos .= "<a href=\"/tos\">Terms of use</a>";
     $tos .= " and ";
     $tos .= "<a href=\"/privacy\">Privacy Policy</a>.";
     $form->add(DisplayField::name('tos')->value($tos));
     $form->setSubmitText("Create your account");
     $form->setSubmitClass("btn btn-success btn-large");
     return $form;
 }