Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * Login Page class file.
4
 *
5
 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2005-2006 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: Login.php 1400 2006-09-09 03:13:44Z wei $
10
 * @package Demos
11
 */
12
 
13
/**
14
 * Login page class.
15
 *
16
 * Validate the user credentials and redirect to requested page
17
 * if successful.
18
 *
19
 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
20
 * @version $Id: Login.php 1400 2006-09-09 03:13:44Z wei $
21
 * @package Demos
22
 * @since 3.1
23
 */
24
class Login extends TPage
25
{
26
	/**
27
	 * Validates the username and password.
28
	 * @param TControl custom validator that created the event.
29
	 * @param TServerValidateEventParameter validation parameters.
30
	 */
31
	public function validateUser($sender, $param)
32
	{
33
		$authManager=$this->Application->getModule('auth');
34
		if(!$authManager->login($this->username->Text,$this->password->Text))
35
			$param->IsValid=false;;
36
	}
37
 
38
	/**
39
	 * Redirect to the requested page if login is successful.
40
	 * @param TControl button control that created the event.
41
	 * @param TEventParameter event parameters.
42
	 */
43
	public function doLogin($sender, $param)
44
	{
45
		if($this->Page->IsValid)
46
		{
47
			$auth = $this->Application->getModule('auth');
48
			if($this->remember->Checked)
49
				$auth->rememberSignon($this->User);
50
			$this->Response->redirect($auth->getReturnUrl());
51
		}
52
	}
53
}
54
 
55
?>