This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

noor.totah.9113817
noor.totah.9113817

I really want to override the functionality of the OnSiginin function called in data-request="onSiginin" on the Login Forms. Where to do that ? and How to call the new function on the data-request ?

daftspunky
daftspunky

You could do it via the page code like this

[account]
==
// This function takes priority over the components
function onSignin()
{
    // Do custom logic here
    return $this->account->onSignin();
}
==
...

Last updated

info15011
info15011

Where to put that code?

Parsec
Parsec

In the code of the page itself in between the upper and lower '=='

info15011
info15011

Thanks! it worked.

LilEssam
LilEssam

as daftspunk said you can just define onSignin function in your Layout and it will be overrided.

chrisiek
chrisiek

When I try to do this

    $code = implode('!', [$user->id, $user->getResetPasswordCode()]);
    $link = $this->controller->currentPageUrl([
        $this->property('paramCode') => $code
    ]);

in '// Do custom logic here' below

[account]
==
// This function takes priority over the components
function onSignin()
{
    // Do custom logic here
    return $this->account->onSignin();
}
==
...

I get an error

"call_user_func_array() expects parameter 1 to be a valid callback, class 'Cms\Classes\Controller' does not have a method 'property'" on line 112 of /home/vagrant/Code/octobercms/modules/cms/Classes/CodeBase.php

It looks like property() method isn't available in this new overriding function. Why is that?

chrisiek
chrisiek

Because I'm trying to get properties of the account component in the overriding function, this is how the correct logic should look like.

$this->account->property('paramCode') => $code

1-8 of 8

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.