<?php
/**
 * class auth_login_form
 *
 * Description for class auth_login_form
 *
 * @author:
*/
namespace form;

use core\form;

class auth_login_form extends form {
	public $email = "";
	public $password = "";

	public function init() {
		$this->addElement("email", array("required"));
		$this->addElement("password", array("required"));
	}

	public function valid() {
		if(!$this->send) {
			return false;
		}

		$valid = true;

		$this->email = $this->getElement("email")->getValue();
		if(empty($this->email)) {
			$this->elements["email"]->setError("Pole wymagane");
			$valid = false;
		}

		$this->password = $this->getElement("password")->getValue();
		if(empty($this->password)) {
			$this->elements["password"]->setError("Pole wymagane");
			$valid = false;
		}
		
		return $valid;
	}
}
?>