Thanks for looking
To clear up the confusing statement:
When I tried adding &loginResourceId to my [[!Login]] the only change in behaviour is: on entering a correct username/password, the page redirects to the id specified.
Maybe I’m just being dense, but I still don’t know what you mean by "logging in from the ’other’ context." When user’s log in, they log in to a specific context (the one the Login page is in). They’re not logged in to any other contexts AFAIK, though I don’t know what the new "experimental" &contexts parameter does.
example [[!Login? &tplType=`modChunk` &loginTpl=`lgnRALoginTpl` &loginResourceId=`14`]] call. I’ve placed this in my template so it appears in every page.
yeah It feels like all I have been doing is flushing permissions and clearing caches
As a side note I updated Login to 1.2.0 rc2 and added &contexts=`web,other,mgr` if I login from the ’web’ context this works for ’web’ and ’mgr’ but not ’other’.
But if I try from the ’other’ context it wont log me in to anything. Just a silent fail - (I wish I knew how to debug modx code properly)
I’m assuming sessions do not persist across different domains could this be stuffing up my ’other’ context.?
Sorry, I’m still confused. This is the normal behavior. If you don’t include that parameter, Login will redirect to itself. If you do, it will redirect to the specified page. What else would you want it to do? If it’s sending you to the other page, you’ve successfully logged in.Ok sorry for the continued confusion. so hopefully to clear this up:
I still don’t know what you mean by "logging in from the ’other’ context." When user’s log in, they log in to a specific context (the one the Login page is in). They’re not logged in to any other contexts AFAIK, though I don’t know what the new "experimental" &contexts parameter does.
[[!Login? &loginResourceId=`82`]]
[[!Profile]] <p>[[+username]] is logged in</p>
/* verify authenticated status if no user specified */ if (empty($user) return 'User is empty';
# Only apply to URLs on this domain RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ # Only apply to URLs that aren't already under folder. RewriteCond %{REQUEST_URI} !^/folder/ # Don't apply to URLs that go to existing files or folders. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Rewrite all those to insert /folder. RewriteRule ^(.*)$ /folder/$1 # Also redirect the root folder. RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteRule ^(/)?$ folder/index.php [L]
Have you tried the newest version of the Login snippet with the &contexts parameter?
$onBeforeLoginParams = array( 'username' => $username, 'password' => $givenPassword, 'attributes' => array( 'rememberme' => & $rememberme, 'lifetime' => & $lifetime, 'loginContext' => & $loginContext ) ); $rt = false; /* $rt will be an array if the event fires */ if ($loginContext == 'mgr') { $rt = $modx->invokeEvent("OnBeforeManagerLogin", $onBeforeLoginParams); } else { $rt = $modx->invokeEvent("OnBeforeWebLogin", $onBeforeLoginParams); }
[[!Login? &loginResourceId=`82` &contexts=`web,mycontext1`]]
UPDATE 2:
I think it is working!!! I have added the 'web' context to the &contexts parameter in my call and now I can log in. So now my snippet call looks like:
[[!Login? &loginResourceId=`82` &contexts=`web,mycontext1`]]
I'm not sure if this is how it should work, as I would assume that you don't always necessarily want to log a user into both the web context and another context?!