I added a rule to redirect after "user has logged in". However, when a user request a password reset, the user gets an email with a temp link, this link auto logs in the user. This will cause the rule to fire. Instead of getting the user account page (where password can be reset), it sends the page to the destination defined in the rule. The use is confused and doesn't know where to go to reset the password.

I'm trying to add a condition to check if a user has logged in via the normal login page, but I couldn't figure out what should be the condition. Can someone help? Thx!

CommentFileSizeAuthor
#18 rules_path_regexp.patch3.88 KBneochief
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fago’s picture

Title: redirect on "user has logged in" cause problem with password reset » Check current path condition
Component: Rules Core » Rules Engine
Category: support » feature

You could check the current path, however there is no special condition for this yet. You can use a textual comparion and compare it to a token (I'm not sure if there is such a token in 6.x?) or to the result of the php function arg: http://api.drupal.org/api/function/arg/6

Maybe we should do such a condition though.

amitaibu’s picture

for this task I'm using a PHP condition + use menu_get_item(). Maybe we can add it as a variable:

$item = menu_get_item;
return $item['path'];
newbuntu’s picture

I added a php execution condition:

$url = drupal_get_path_alias($_GET['q']);
return strstr($url, 'user/login');

newbuntu’s picture

Status: Active » Closed (fixed)
mrfelton’s picture

Adding this as a condition that is configurable through the UI without the need for php coding would be a nice addition

cerup’s picture

How do you go about adding this as a condition, php or other? I'm not sure that it's explained above.

I'd like to have a check if the current page against a path.

mitchell’s picture

Status: Closed (fixed) » Active

Setting this back to active as per fago's comment:

Maybe we should do such a condition though.

See #2 or #3 for current workarounds.

Bilmar’s picture

+1 subscribing

UNarmed’s picture

How do i add the PHP condition mentioned at #2 and #3 to my rule?

YK85’s picture

Hi,

I was wondering if there has been any further development on this?

Thanks!

mitchell’s picture

Status: Active » Postponed (maintainer needs more info)

See: Path Rules

@fago: Would you like to merge this module into 6.x-1.x-dev. It appears to be stable, so I doubt it will hold you up on 6.x-1.2.

YK85’s picture

awesome, i tested http://drupal.org/project/pathrules and it would be great to see this in rules core module

fago’s picture

yep, imho that make sense. Feel free to roll a patch. However for 1.2 you need to hurry.. ;)

klausi’s picture

Status: Postponed (maintainer needs more info) » Needs work
YK85’s picture

would anyone be able to kindly roll a patch to integrate the features of pathrules module into rules?
thank you!

mitchell’s picture

Title: Check current path condition » Condition: check path (starts with, ends with, contains, is equal to)
Issue tags: +rules 1.3

Big bump. This one issue is good cause for a new 6.x release for at least 618 rules users.

fago’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Status: Needs work » Active

Let's add this feature for 7.x first (this is where new features are added). By adding a new property in entity metadata ala system:current-path this should be rather easy. Then we need to ensure we have a good textual comparison that is capable of doing all operators off "starts with, ends with, contains, is equal to".

neochief’s picture

FileSize
3.88 KB

Here's the one with regular expressions, I used for my project.

stella’s picture

subscribe, willing to test any d6 patch

fago’s picture

Title: Condition: check path (starts with, ends with, contains, is equal to) » Improve textual conditions (starts with, ends with, contains, is equal to, regex)

We really should do just an improved textual comparison condition, i.e. improve the data comparison condition.

perusio’s picture

Yes. But the fact remains that there's no condition for the current path, even if you extend the textual comparison condition o include the above mentioned operators. So I guess that the patch integrating pathrules is still useful. Is it not?

fago’s picture

In the latest entity API, there is site:current-page:path or so, which you can use. So you probably don't need pathrules.

fago’s picture

ad #20:
For 7.x, best I think this should be a separate condition that can focus on a textual comparisons and thus provide features like the regex match.

fago’s picture

Status: Active » Fixed

I've implemented that as a "Text comparison" condition and committed it.

Status: Fixed » Closed (fixed)
Issue tags: -rules 1.3

Automatically closed -- issue fixed for 2 weeks with no activity.