Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes #4290 - Automatically creating tokens only when a token isn't set #41

Closed
wants to merge 1 commit into from

4 participants

Gabe Evans Kohana Builds Kiall Mac Innes Kemal Delalic
Gabe Evans

Also, not 100% sure this is something that should be applied to 3.2/develop or held off until there's a 3.3 branch.

Kohana Builds
Collaborator

Jenkins Build Starting

Gabe Evans

Nice.

22:12:48  There was 1 failure:
22:12:48  
22:12:48  1) Kohana_Cache_FileTest::test_set_get with data set #6 (array('object', stdClass, 0, false, 'object', NULL), stdClass)
22:12:48  Failed asserting that <null> is equal to 
22:12:48  stdClass Object
22:12:48  (
22:12:48      [foo] => foo
22:12:48      [bar] => bar
22:12:48  )
Kiall Mac Innes

Humm .. looks like a bug in the cache tests triggered this to fail...

!build

Kohana Builds
Collaborator

Jenkins Build Starting

Kemal Delalic kemo commented on the diff
classes/model/auth/user/token.php
((11 lines not shown))
public function create(Validation $validation = NULL)
{
- $this->token = $this->create_token();
+ if ($this->token === NULL OR ORM::factory('user_token', array('token' => $token))->loaded())
+ {
Kemal Delalic Collaborator
kemo added a note

I don't see $token defined anywhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Kemal Delalic
Collaborator

Targeted against the wrong branch + undefined variable $token used in ORM::factory('user_token', array('token' => $token))->loaded(). Closing

Kemal Delalic kemo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 30, 2011
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 2 deletions.
  1. +12 −2 classes/model/auth/user/token.php
14 classes/model/auth/user/token.php
View
@@ -1,6 +1,6 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
- * Default auth user toke
+ * Default auth user token
*
* @package Kohana/Auth
* @author Kohana Team
@@ -49,9 +49,19 @@ public function delete_expired()
return $this;
}
+ /**
+ * Generates a unique token when one isn't already set and inserts it to
+ * the database.
+ *
+ * @param Validation $validation Validation object
+ * @return ORM
+ */
public function create(Validation $validation = NULL)
{
- $this->token = $this->create_token();
+ if ($this->token === NULL OR ORM::factory('user_token', array('token' => $token))->loaded())
+ {
Kemal Delalic Collaborator
kemo added a note

I don't see $token defined anywhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ $this->token = $this->create_token();
+ }
return parent::create($validation);
}
Something went wrong with that request. Please try again.