<?php

if (!defined('XOOPS_ROOT_PATH')) exit();

require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php";

/**
 * This class is generated by makeActionForm tool.
 */
class LostPassEditForm extends XCube_ActionForm
{
	function getTokenName()
	{
		return "module.user.LostPassEditForm.TOKEN";
	}

	function prepare()
	{
		//
		// Set form properties
		//
		$this->mFormProperties['email'] =& new XCube_StringProperty('email');
		$this->mFormProperties['code'] =& new XCube_StringProperty('code');
		$this->mFormProperties['newpass'] =& new XCube_StringProperty('newpass');

		//
		// Set field properties
		//
		$this->mFieldProperties['email'] =& new XCube_FieldProperty($this);
		$this->mFieldProperties['email']->setDependsByArray(array('required'));
		$this->mFieldProperties['email']->addMessage('required', _MD_USER_ERROR_REQUIRED, _MD_USER_LANG_EMAIL);
	}
	
	function validateEmail()
	{
		if ($this->get('email') != null && !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i",$this->get('email'))) {
			$this->addErrorMessage(_MD_USER_ERROR_EMAIL_FORMAT);
		}
	}
}

?>
