So the problem lies in $this->controller, inside the component. This
object should be set in the components startup function, which is
called at the initialization of the component. Did you change
something related to that function?
Also, $salt is not known inside your controller, it's a variable from
inside the component. That might explain why $this-
>set('special_sauce', $salt); doesn't work.
On Mar 10, 11:33 pm, "Hubbo" <[EMAIL PROTECTED]> wrote:
> What do you mean? I didn't fix that error because I haven't figured
> out how to fix it. That error shows up if I use the solution you
> posted in the bakery (and yes, with the dauth component loaded in
> appcontroller). I have managed to get around that error if I use this
> solution:
>
> function newSalt()
> {
> $salt = crc32(time());
> //$this->controller->set('special_sauce',$salt);
> $this->Session->write('salt', $salt);
>
> return $salt;
> }
>
> function beforeFilter()
> {
> $error = '';
> $salt = $this->DAuth->newSalt();
> $this->set('special_sauce', $salt);
> $this->set('error', $error);
> $this->set('allowcleartext', $this->DAuth->allowClearText);
>
> }
>
> That is; return the salt value instead of assigning it directly to
> 'special_sauce' in newSalt() and then assigning it in beforeFilter()
> in appcontroller. But by using this method I get a credentials
> mismatch.
>
> Look, dauth works fine as long as I use a separate login page and
> controller, as the /users/login you posted as an example. But it's
> when I'm trying to use it application wide things goes wrong.
>
> On Mar 10, 8:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > Fatal error: Call to a member function set() on a non-object in /
> > DEVELOPMENT/app/controllers/components/d_auth.php on line 350
>
> > So you fixed the above error <em>without</em> hacking my code?
>
> > On Mar 10, 3:43 pm, "Hubbo" <[EMAIL PROTECTED]> wrote:
>
> > > I'm sorry but I didn't mean it like that. I can't get it to work with
> > > the solution you posted and I have followed your advice very
> > > carefully. Now, I think the solution where you return the salt value
> > > in newSalt() instead is better (for me anyways) but I can't understand
> > > why there is a credentials mismatch. How is it any difference setting
> > > the 'special_sauce' in AppController's beforeFilter than in newSalt()?
> > > I've been trying this for days now with no luck and that's why I'm
> > > posting here.
>
> > > On Mar 10, 3:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > > so it "doesn't work" huh?
> > > > well...
>
> > > > the best advice i can give you with this information is: make it work
>
> > > > On Mar 10, 3:04 pm, "Hubbo" <[EMAIL PROTECTED]> wrote:
>
> > > > > (whoops, did a reply to author. I'll post again here)
>
> > > > > The DAuth component is loaded in my appcontroller and doesn't work.
>
> > > > > On Mar 10, 2:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > > > > you need the dAuth component in your appcontroller to do that.
> > > > > > (like
> > > > > > i said in that comment)
> > > > > > if you include the component, and change the code back to what i
> > > > > > posted, it should work.
>
> > > > > > On Mar 10, 2:24 pm, "Hubbo" <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I'm using dAuth and want a login form that is accessible on all
> > > > > > > pages
> > > > > > > on the site. Following Dieter's advice in comment 53
> > > > > > > onhttp://bakery.cakephp.org/articles/view/147mybeforeFilter() in
> > > > > > > AppController now looks like this:
>
> > > > > > > function beforeFilter()
> > > > > > > {
> > > > > > > $error = '';
> > > > > > > $this->DAuth->newSalt();
> > > > > > > $this->set('error', $error);
> > > > > > > $this->set('allowcleartext',
> > > > > > > $this->DAuth->allowClearText);
> > > > > > > }
>
> > > > > > > By using this solution I get this error message:
> > > > > > > Fatal error: Call to a member function set() on a non-object in /
> > > > > > > DEVELOPMENT/app/controllers/components/d_auth.php on line 350
>
> > > > > > > So I changed newSalt() in the dAuthComponent to return the salt
> > > > > > > value
> > > > > > > instead:
>
> > > > > > > function newSalt()
> > > > > > > {
> > > > > > > $salt = crc32(time());
> > > > > > > //$this->controller->set('special_sauce',$salt);
> > > > > > > $this->Session->write('salt', $salt);
>
> > > > > > > return $salt;
> > > > > > > }
>
> > > > > > > and beforeFilter() now looks like this:
>
> > > > > > > function beforeFilter()
> > > > > > > {
> > > > > > > $error = '';
> > > > > > > $salt = $this->DAuth->newSalt();
> > > > > > > $this->set('special_sauce', $salt);
> > > > > > > $this->set('error', $error);
> > > > > > > $this->set('allowcleartext',
> > > > > > > $this->DAuth->allowClearText);
> > > > > > > }
>
> > > > > > > But by using this method I end up with a credentials mismatch
> > > > > > > error. I
> > > > > > > can't figure out what the problem is. Any advice would be great!
>
> > > > > > > //Miche
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---