I have searched and can not find the right answer, so I'm hoping I can be pointed in the right direction.
I'm working on a login, we are storing the email as well as password in a table. Password is MD5'ed in the table, email is not.
Under the Login form:
class Application_Form_Login extends Zend_Form
{
public function init()
{
$this->setName('signupForm');
$this->setMethod('post');
$this->setAction('/User/Login');
$id = new Zend_Form_Element_Hidden('id');
$id->addFilter('Int');
$emailAddress = new Zend_Form_Element_Text('emailAddress');
$emailAddress->setLabel('Email Address')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty')
->addValidator('EmailAddress');
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password:')
->addValidator('StringLength', false, array(6,24))
->setLabel('Password')
->setRequired(true);
$submit = new Zend_Form_Element_Submit('Login');
$submit->setAttrib('id', 'submitbutton');
$this->addElements(array($id, $emailAddress,$password,$submit));
}
}
I need to check the DB based on two elements (email and password), I also need to process the password with MD5 before comparing it to the DB. How should I go about this in ZF.
I'm not sure if I should construct my own validation check, or use something built within ZF that I have not learned about.