Guest User

Untitled

a guest
Jul 29th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <?php
  2. include('prepend.inc.php');
  3.  
  4. class LoginForm extends MainForm {
  5. protected $txtUsername;
  6. protected $txtPassword;
  7. protected $btnSave;
  8.  
  9. protected function Form_Create() {
  10. parent::Form_Create();
  11. if (parent::IsLoggedIn()) {
  12. QApplication::Redirect('/file_list');
  13. }
  14.  
  15. $this->txtUsername_Create();
  16. $this->txtPassword_Create();
  17. $this->btnSave_Create();
  18. }
  19.  
  20. protected function txtUsername_Create() {
  21. $this->txtUsername = new QTextBox($this);
  22. $this->txtUsername->Name = QApplication::Translate('Username');
  23. }
  24.  
  25. protected function txtPassword_Create() {
  26. $this->txtPassword = new QTextBox($this);
  27. $this->txtPassword->Name = QApplication::Translate('Password');
  28. $this->txtPassword->TextMode = QTextMode::Password;
  29. }
  30.  
  31. protected function btnSave_Create() {
  32. $this->btnSave = new QButton($this);
  33. $this->btnSave->Text = QApplication::Translate('Login');
  34. $this->btnSave->AddAction(new QClickEvent(), new QServerAction('btnSave_Click'));
  35. $this->btnSave->PrimaryButton = true;
  36. }
  37.  
  38. public function btnSave_Click($strFormId, $strControlId, $strParameter) {
  39. if (parent::Authenticate($this->txtUsername->Text, $this->txtPassword->Text)) {
  40. QApplication::Redirect('/file_list');
  41. }
  42. }
  43. };
  44.  
  45. LoginForm::Run('LoginForm', __TEMPLATES__ . '/login.tpl');
  46. ?>
Add Comment
Please, Sign In to add comment