Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('prepend.inc.php');
- class LoginForm extends MainForm {
- protected $txtUsername;
- protected $txtPassword;
- protected $btnSave;
- protected function Form_Create() {
- parent::Form_Create();
- if (parent::IsLoggedIn()) {
- QApplication::Redirect('/file_list');
- }
- $this->txtUsername_Create();
- $this->txtPassword_Create();
- $this->btnSave_Create();
- }
- protected function txtUsername_Create() {
- $this->txtUsername = new QTextBox($this);
- $this->txtUsername->Name = QApplication::Translate('Username');
- }
- protected function txtPassword_Create() {
- $this->txtPassword = new QTextBox($this);
- $this->txtPassword->Name = QApplication::Translate('Password');
- $this->txtPassword->TextMode = QTextMode::Password;
- }
- protected function btnSave_Create() {
- $this->btnSave = new QButton($this);
- $this->btnSave->Text = QApplication::Translate('Login');
- $this->btnSave->AddAction(new QClickEvent(), new QServerAction('btnSave_Click'));
- $this->btnSave->PrimaryButton = true;
- }
- public function btnSave_Click($strFormId, $strControlId, $strParameter) {
- if (parent::Authenticate($this->txtUsername->Text, $this->txtPassword->Text)) {
- QApplication::Redirect('/file_list');
- }
- }
- };
- LoginForm::Run('LoginForm', __TEMPLATES__ . '/login.tpl');
- ?>
Add Comment
Please, Sign In to add comment