Browse Source

minor fixes

euromark 13 years ago
parent
commit
c6e5d53b43

+ 2 - 0
Controller/Component/AuthExtComponent.php

@@ -91,6 +91,8 @@ class AuthExtComponent extends AuthComponent {
 
 		if (empty($user)) {
 			$user = $this->identify($this->Controller->request, $this->Controller->response);
+		} elseif (!is_array($user)) {
+			$user = $this->completeAuth($user);
 		}
 		if (empty($user)) {
 			$this->loginError = __('invalidLoginCredentials');

+ 4 - 3
Lib/MyCakeTestCase.php

@@ -77,11 +77,12 @@ abstract class MyCakeTestCase extends CakeTestCase {
 	 * @return void
 	 * 2011-12-04 ms
 	 */
-	public function out($data, $pre = true) {
+	public static function out($data, $pre = true) {
 		if ($pre) {
-			$data = pre($data);
+			pr($data);
+		} else {
+			echo $data;
 		}
-		echo $data;
 		if (empty($_SERVER['HTTP_HOST'])) {
 			# cli mode / shell access: use the --debug modifier if you are using the CLI interface
 			return;

+ 2 - 0
Model/Behavior/ChangePasswordBehavior.php

@@ -24,6 +24,7 @@ if (!defined('PWD_MAX_LENGTH')) {
  * - complete validation
  * - hashing of password
  * - requires fields (no tempering even without security component)
+ * - usable for edit forms (allowEmpty=>true for optional password update)
  *
  * usage: do NOT add it via $actAs = array()
  * attach it dynamically in only those actions where you actually change the password like so:
@@ -41,6 +42,7 @@ if (!defined('PWD_MAX_LENGTH')) {
  *
  * @version 1.5
  * @author Mark Scherer
+ * @link http://www.dereuromark.de/2011/08/25/working-with-passwords-in-cakephp
  * @license MIT
  * 2011-08-24 ms
  */

+ 22 - 1
View/Elements/pagination.ctp

@@ -46,4 +46,25 @@ echo $this->Paginator->counter(array(
 	<?php echo $this->Paginator->next($next, array(), null, array('class' => 'disabled'));?>
  <?php echo $separator; ?>
 	<?php echo $this->Paginator->last($last, array());?>
-</div>
+</div>
+<?php if (!empty($options['ajaxPagination'])) {
+	$ajaxContainer = !empty($options['paginationContainer']) ? $options['paginationContainer'] : '.page';
+
+	$script = "$(document).ready(function() {
+	$('div.paging a').live('click', function () {
+		$('$ajaxContainer').fadeTo(300, 0);
+
+		var thisHref = $(this).attr('href');
+
+		$('$ajaxContainer').load(thisHref, function() {
+			$(this).fadeTo(200, 1);
+			$('html, body').animate({
+				scrollTop: $('$ajaxContainer').offset().top
+			}, 200);
+		});
+		return false;
+	});
+});";
+
+	$this->Js->buffer($script);
+} ?>