From dd028bec3822d1d9c28c35d599d687e038c7705f Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 4 Jan 2007 11:23:26 +0000 Subject: Add chat demo and tutorial. --- demos/chat/protected/pages/Login.php | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 demos/chat/protected/pages/Login.php (limited to 'demos/chat/protected/pages/Login.php') diff --git a/demos/chat/protected/pages/Login.php b/demos/chat/protected/pages/Login.php new file mode 100644 index 00000000..831ab925 --- /dev/null +++ b/demos/chat/protected/pages/Login.php @@ -0,0 +1,40 @@ +Application->Modules['users']; + if($manager->usernameExists($this->username->Text)) + $param->IsValid = false; + } + + /** + * Create and login a new user, then redirect to the requested page. + * @param TControl button control that created the event. + * @param TEventParameter event parameters. + */ + function createNewUser($sender, $param) + { + if($this->Page->IsValid) + { + $manager = $this->Application->Modules['users']; + $manager->addNewUser($this->username->Text); + + //do manual login + $user = $manager->getUser($this->username->Text); + $auth = $this->Application->Modules['auth']; + $auth->updateSessionUser($user); + $this->Application->User = $user; + + $this->Response->redirect($auth->ReturnUrl); + } + } +} + +?> \ No newline at end of file -- cgit v1.2.3