public function initialize() { $email = new \Phalcon\Forms\Element\Email('email', array('placeholder' => '*****@*****.**')); $email->setLabel('Enter Your E-Mail:'); $email->addValidator(new \Phalcon\Validation\Validator\Email(array('message' => 'The E-Mail is not valid.'))); $this->add($email); $password = new \Phalcon\Forms\Element\Password('password', array('placeholder' => 'Your password')); $password->setLabel('Password:'******'message' => 'The Password is required.'))); $this->add($password); }
public function loginAction() { $form = new \Phalcon\Forms\Form(); $form->add($user = new \Phalcon\Forms\Element\Email('user')); $form->add($pass = new \Phalcon\Forms\Element\Password('password')); $form->add($twoFactorAuth = new \Phalcon\Forms\Element\Numeric('token')); $user->addValidator(new PresenceOf(['message' => 'Username is required.'])); $pass->addValidator(new PresenceOf(['message' => 'Password is required.'])); $twoFactorAuth->addValidator(new PresenceOf(['message' => 'Token is required.'])); $this->view->setVar('form', $form); if ($this->request->isPost() && $form->isValid($this->request->getPost())) { if (!$this->security->checkToken()) { $this->flash->error('The form security token was invalid. Please submit the form again.'); $this->cleanUpRequest(); return false; } $this->tryLogin($this->request->getPost()); } $this->cleanUpRequest(); }
public function initialize() { $email = new \Phalcon\Forms\Element\Email('email', array('placeholder' => '*****@*****.**')); $email->setLabel('Enter Your E-Mail:'); $email->addValidators(array(new \Phalcon\Validation\Validator\Email(array('message' => 'E-Mail is not valid.')))); $this->add($email); $password = new \Phalcon\Forms\Element\Password('password', array('placeholder' => 'Your password')); $password->setLabel('Password:'******'min' => 6, 'messageMinimum' => 'Password is not valid.')))); $this->add($password); $confirm_password = new \Phalcon\Forms\Element\Password('confirm_password', array('placeholder' => 'Confirm')); $confirm_password->setLabel('Confirm password:'******'with' => 'password', 'message' => 'Password doesn\'t match confirmation.'))); $this->add($confirm_password); $name = new \Phalcon\Forms\Element\Text('name', array('placeholder' => 'Ivan')); $name->setLabel('Name:'); $name->addValidators(array(new \Phalcon\Validation\Validator\StringLength(array('min' => 3, 'messageMinimum' => 'Name is not valid.')))); $this->add($name); $lastname = new \Phalcon\Forms\Element\Text('lastname', array('placeholder' => 'Ivanovich')); $lastname->setLabel('Lastname:'); $lastname->addValidators(array(new \Phalcon\Validation\Validator\StringLength(array('min' => 3, 'messageMinimum' => 'Lastname is not valid.')))); $this->add($lastname); }