Drupal Rules One time login address - drupal

I am trying to send out an email using a drupal onetime login. I have created a custom token which executes the following php.
return user_pass_reset_url($user);
I then use this in my rule. A link is sent to the user but when they click on the link it says it has all ready been used. I have no idea why because the link in the email looks correct (contains correct user id etc).

Have you looked into using the Login one time module (http://drupal.org/project/login_one_time)? We're using it on a production site and it works great.

Related

setting up customize action URL in firebase email template dynamically

I have two web application sharing one firebase (auth, db etc), it all works well, but i when users want to do a reset password, the email i can see in the Password reset template allows me to change it but i don't want to be hard specific on the url, given the password request might come from either application, is there a way to let firebase know which link to use or possibly set it from the code ?
It is not possible to change it to a fully customized URL(like mywebapp1.com), the reason for that is that it won't be possible to check if the modified URL is a valid one.
You have 2 options:
You can get a custom domain like authApp.com and follow these steps on the documentation so you can have a more personalized experience for both apps.
You can create dedicated emails based on the app (the URL will stay the same) using action links , this will show a nice layer of customization to your emails based on the specific web app being used.

The security token did not match. The request was aborted to prevent any security breach. Please try again

I've got the error above in my Joomla website when I either try to log in or create a new account from the side site. I have also noticed the two following things:
if I create a new user from the backend, this doesn't appear in the _users table;
a file named ".myjoomla.configuration.php.md5", containing an alphanumeric string, is automatically generated in the website root every time I try to log in vainly from the frontend. Besides, it turns up again if I remove it manually through FTP.
Did my website get hacked? How could I fix it?
".myjoomla.configuration.php.md5" contains the md5 hash of the configuration.php file and appears on your site as part of the mySites.guru service you either subscribed to or trialled. It is part of the near-realtime alerting service which detects when configuration.php has been changed and alerts you if you are a paying subscriber of the mySites.guru service. It is NOT an indication of a hack at all.
Disclaimer: It is code I wrote and a service I run, so I know what Im talking about.
Not being able to create users - Im guessing you have Admin Tools or RSFirewall installed and configured, both these products stop users being created IF configured that way.
Token issues: These are well covered in Joomla documentation and forums. They are CSRF tokens and if yours is not validating then try NOT double clicking the buttons, check your session handlers are working, and check your cookies are working as expected
Nothing you say leads me to believe your site is hacked
The issue I've encountered was about the Joomla native Login module. As I published it in all the pages of my website and clicked on the login link appeared on the frontend side, I was redirected to a link that looked like
mysite.com/index.php/component/users/?view=login&Itemid=yourid
which displayed the login page correctly. Yet, once filled in the form and submitted it, the warning message in question popped out. The same problem occurred when either trying to register a new account or reset the password.
Although I couldn't find an explanation to the issue, I managed to fix it by creating a Login, Reset and Registration menu items under the main menu and then hidden them as I didn't want them to show up among the other menu items on the frontend.
Went back to the frontend and clicked on login, I was now redirected to a different url that looks like
mysite.com/login
where "login" is the alias that I had chosen for the Login menu item.
After having filled in the form and submitted it, I was able to log in successfully. Likewise, Registration and Reset operations worked.

How to run a function before route is displayed in Wordpress?

I am trying to do the equivalent of Laravel Middleware for my WordPress site.
I am implementing a real time notification system and when a user clicks on a notification, there will be query string ?read
So I will have url like myapp.net/lesson/some-lesson?read
I need to tap into WordPress somewhere so that I can check the url and mark off in my database that the message was read so that when the lesson page loads the notification is already cleared. Searching for route related hooks isn't pulling up anything useful.
What can I try next?

Failed to send email from contact form 7

I am using contact form 7 one of my wordpress site that using vantage app theme. But problem with sending contact mail. when I am trying to send mail get following message
"Failed to send your message. Please try later or contact the administrator by another method."
Thanks
The only problem is you can send emails from you hosting domain email accounts only.
so check your to email address that is comes under you domain name
I hope this will solve your problem
This is almost certainly due to your particular hosting setup. There are a host of issues that can stop the sending of emails. It depends entirely on your local Server & WordPress configuration.
You will need to investigate this issue for your particular local configuration. See Contact Form 7 Email Issues.
By the way it's not due to "hosting php version or maybe mysql version" - it's due to basic stuff that you can address by working through the issues in the link.
I faced the same issue some time back. Are you using any WordPress caching plugin? like WP super-cache? I resolved this issue by following below steps on WP Super-cache.
Go to WP Super-Cache Admin panel
Go to “Advanced Tab”
Search for “Add here strings (not a filename) that forces a page not to be cached.”
Add '/contact/' (your Contact Form Page name)
Save Strings.
I was able to fix this problem after I spoke to my client's hosting company. The host claimed that the only requirement they had for emails to be passed through their system was that either the To: or the From: field contain an email address under the hosted domain name. They uploaded a test script (an ordinary PHP mail script) where the From: field was set with an address within the domain and the To: field was set to an outside email address. That script worked. I confirmed that I had the To: field in CF7 set to an email address within the appropriate domain but the form didn't function. Then I set the From: field to an email address within the domain and the form finally functioned. It appeared, therefore, that the host was incorrect about the To: field's address being within the domain being sufficient.
Into the "Form"(inside the mail menu) section you've to give the domain name of your site. And inside the message body use the short codes which will appear into the top of the mail menu.
And when you create a form field such as "name" / "email" / "phone no" etc, then give a name to them. Those name turns into a short codes like
[your-name]-Name, [your-mail]-Email(those are defaults, you can give any name according to your choice) etc, copy the short code and paste into the message body, don't write it only copy and paste.
Hope this will help you.
This suggestion depends on how your hosting provider deals with mail headers:
So, I have made all tests (javascript conflicts, etc.) and decided the problem could only be from my host. I contacted them and they told me that in email header, the "From:" SHOULD be exactly the same as the email I configured to receive the messages from my visitors.
As far as I understood, by default "Contact Form 7" uses visitor email to put it in "From:" but some host providers do not allow that.
My host provider don't even allow mail() function so I had to install WP MAIL SMTP.
So, resuming, I just added this to all my forms in "Additional headers":
From: your#domain.com
This means, you have to insert one email with same domain name as your website, otherwise your hosting might not send the email.
I lost a couple of hours with this...
Maybe is another plugin incompatible with contact form7 plugin.
Deactivate all plugin one by one and try send email.
I fixed the problem. webadmin email account was not setup. Once I setup the email account it is working fine.

Show uploaded files to Anonymous user but only allow download from registered

On Drupal 6 I am attaching a file to a node. This can be done using the core upload module or as a CCK field (What ever will achieve the permissions issue).
I would like anonymous users to be able to see the file, but once they click on it to be prompted to login or register. Once logged in (or registered) then to be taken to either the same page they started on or start the download.
Not really sure where to start on this (related to the permissions and then the eventual redirect).
One method that i would do is in the template files detect if there is a userid variable (To indicate they are logged in), if there is show the link to the file - if they are not then to send to the login/registration page. I can store the link they wanted in the user session. But then how would i detect their registration is complete and redirect them to the page/file?
Ideally there is a module (which I am still hunting around for) that does this task!
Basically, you just need to set the destination parameter, this works for the basic login/registration form. If you however require something like email confirmation for registration, then it's going to be a lot more complicated.
Example Links:
user/login?destination=download_url
user/register?destination=download_url
There is also an API function that will automatically generate the destination part for the current URL: http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_get_destination/7.

Resources