Changeset 138
- Timestamp:
- 08/05/09 19:46:04 (13 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
application/controllers/users.php (modified) (4 diffs)
-
application/views/header.php (modified) (1 diff)
-
library/classes/scontroller.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/application/controllers/users.php
r115 r138 20 20 } 21 21 } 22 22 23 23 function login() { 24 24 if($_POST) { 25 $validate['username'] = 'minLen:1'; 26 $validate['password'] = 'minLen:1|callback_passwordCheck'; 27 if($this->validate($validate)){ 25 $validation['username'] = 'minLen:1'; 26 $validation['password'] = 'minLen:1|callback_passwordCheck'; 27 $fields['username'] = 'Username'; 28 $fields['password'] = 'Password'; 29 $this->setValidation($validation); 30 $this->setValidationFields($fields); 31 if($this->validate()) { 32 echo 'validated'; 28 33 try { 29 34 $this->user->login($this->post('username'), $this->post('password')); … … 32 37 $this->data['error'] = $e->getMessage(); 33 38 } 39 } else { 40 $this->data['errors'] = $this->getValidationErrors(); 34 41 } 35 36 } else {37 $this->data['errors'] = $this->getValidationErrors();38 42 } 39 43 $this->template->render('login', $this->data); … … 48 52 49 53 function edit($id='') { 50 if(!$this->user->loggedIn()) {54 if(!$this->user->loggedIn()) { 51 55 redirect('users/login'); 52 56 } 53 if($_POST) {54 57 if($_POST) { 58 55 59 } 56 if(!$id) {60 if(!$id) { 57 61 $this->data['editUser'] = $this->user->getUserData(); 58 62 } else { 59 if($this->user->level == 'admin') {63 if($this->user->level == 'admin') { 60 64 $tempUser = new sUser($id); 61 65 $this->data['editUser'] = $tempUser->getUserData(); … … 64 68 } 65 69 } 66 if($this->user->level == 'admin') {70 if($this->user->level == 'admin') { 67 71 $this->data['levels'] = $this->user->getUserLevels(); 68 72 } 69 73 $this->template->render('edit', $this->data); 70 74 } 71 protected function passwordCheck($password){ 72 if($password === 'password'){ 73 return false; 75 protected function passwordCheck($password) { 76 $return['valid'] = true; 77 $return['error'] = ''; 78 if($password === 'password') { 79 $return['valid'] = false; 80 $return['error'] = ' is password'; 74 81 } 75 return true;82 return $return; 76 83 } 77 84 } -
trunk/application/views/header.php
r125 r138 43 43 <?php echo isset($message) ? '<p class="message">'.$message.'</p>' : ''; ?> 44 44 <?php echo isset($error) ? '<p class="error">'.$error.'</p>' : ''; ?> 45 <?php 46 if(!empty($errors)){ 47 foreach($errors as $error){ 48 echo '<p class="error">'.sEscape::html($error).'</p>'; 49 } 50 } 51 52 ?> -
trunk/library/classes/scontroller.class.php
r131 r138 135 135 return $this->validationErrors; 136 136 } 137 public function getMessages($errors){138 var_dump($errors);139 }140 137 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)