Problem is as follows:
I have a rule which redirects users to a landing page after login. It works fine.
However, if a user forgets their password, they are sent a link to the one-time-login page. They click the button and (because of my rule) are sent to their landing page.
The problem of course is that they cannot then change their password because the normal password change (in the user profile) requires you know your password to change it.
So how would I modify my redirect rule to say:
"Redirect to landing page, unless the logging-in user is coming from the one-time-login screen" or "Redirect to the landing page, unless the target URL starts with /user/reset/* (can you wildcard??)"
Thanks in advance for any tips
You can do that with a rule like that:
{ "rules_after_login_redirect_to_news" : {
"LABEL" : "After login redirect to news.",
"PLUGIN" : "reaction rule",
"WEIGHT" : "0",
"REQUIRES" : [ "rules" ],
"ON" : [ "user_login" ],
"IF" : [
{ "NOT text_matches" : {
"text" : [ "site:current-page:path" ],
"match" : "^user\/reset\/",
"operation" : "regex"
}
}
],
"DO" : [ { "redirect" : { "url" : "news" } } ]
}
}
I fixed this problem just using rules, as outlined in another answer here but i had to modify it to work, i had to set the Text comparison condition to negative, and the page redirect to Force redirect, and the page i wanted was called 'getting-started'. Works Perfect
So the rule i added: EVENTS User has logged in
CONDITIONS NOT Text comparison Parameter: Text: [site:current-page:path], Matching text: user, Comparison operation: starts with
ACTIONS Page redirect Parameter: URL: getting-started
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With