| | 79 | } |
| | 80 | } |
| | 81 | |
| | 82 | return $status; |
| | 83 | } |
| | 84 | |
| | 85 | /** |
| | 86 | * Validates an array for a matching password and password_confirm field. |
| | 87 | * |
| | 88 | * @param array values to check |
| | 89 | * @param string save the user if |
| | 90 | * @return boolean |
| | 91 | */ |
| | 92 | public function change_password(array & $array, $save = FALSE) |
| | 93 | { |
| | 94 | $array = Validation::factory($array) |
| | 95 | ->pre_filter('trim') |
| | 96 | ->add_rules('password', 'required', 'length[5,127]') |
| | 97 | ->add_rules('password_confirm', 'matches[password]'); |
| | 98 | |
| | 99 | if ($status = $array->validate()) |
| | 100 | { |
| | 101 | // Change the password |
| | 102 | $this->password = $array['password']; |
| | 103 | |
| | 104 | if ($save == TRUE AND $status = $this->save()) |
| | 105 | { |
| | 106 | if (is_string($save)) |
| | 107 | { |
| | 108 | // Redirect to the success page |
| | 109 | url::redirect($save); |
| | 110 | } |