public function getLoginForm($returnUrl = null) { $form = new Form(); $form->setMethod('POST'); $form->setAction('/member/login'); $form->disableValidation(); if (!is_null($returnUrl)) { $rtn = new Hidden(); $rtn->setName('rtn'); $rtn->setValue($returnUrl); $form->addField($rtn); } $form->addField(Email::create('email', 'Email Address', true)); $form->addField(Password::create('password', 'Password', true)); $submit = new Submit(); $submit->setClass('button pull-right'); $submit->setValue('Login'); $form->addField($submit); return $form; }
protected function contactForm() { $form = new \Octo\Admin\Form(); $form->addField(Form\Element\Text::create('first_name', 'First Name', true)); $form->addField(Form\Element\Text::create('last_name', 'Last Name', true)); $form->addField(Form\Element\Email::create('email', 'Email Address', true)); $form->addField(Form\Element\Text::create('phone', 'Phone Number')); $form->addField(Form\Element\Text::create('company', 'Company')); $form->addField(Form\Element\Submit::create('submit', 'Save')->setValue('Save Contact')); return $form; }
protected function forgotPasswordForm() { $form = new Form(); $form->setMethod('POST'); $form->setAction('/member/forgot-password'); $form->disableValidation(); $form->addField(Email::create('email', 'Email Address', true)); $submit = new Submit(); $submit->setClass('button pull-right'); $submit->setValue('Submit'); $form->addField($submit); return $form; }
public function profile() { if ($this->getRequest()->getMethod() == 'POST') { $this->currentUser->setEmail($this->getParam('email')); $this->currentUser->setName($this->getParam('name')); $password = $this->getParam('password', ''); if (!empty($password)) { $this->currentUser->setHash(password_hash($password, PASSWORD_DEFAULT)); } $this->currentUser = $this->userStore->save($this->currentUser); $this->successMessage('Profile updated successfully!'); } $this->setTitle($this->currentUser->getName(), 'Edit Profile'); $form = new \Octo\Admin\Form(); $form->setMethod('POST'); $name = Form\Element\Text::create('name', 'Name', true); $name->setValue($this->currentUser->getName()); $email = Form\Element\Email::create('email', 'Email Address', true); $email->setValue($this->currentUser->getEmail()); $password = Form\Element\Password::create('password', 'Password (enter a new password to change)', false); $submit = new Form\Element\Submit(); $submit->setValue('Update Profile'); $submit->setClass('btn btn-success'); $form->addField($name); $form->addField($email); $form->addField($password); $form->addField($submit); $this->view->form = $form; }