Jump to content

email Invoice > automatic login to pay invoice ?


JohnnyL

Recommended Posts

Hi guys,

So i've been wondering, is there any good and safe way to let clients that receive an email with invoices, to click on a link to automatically login - or go to the gateway,, to pay the invoice?

Right now its a bottleneck if they don't remember their login credentials.. they cant click to pay the invoice.

And i saw some modules in the marketplace but all are outdated 😕 so meh, not going to try them, probably not getting maintenance anyway so thats out.

Hope i've explained clear enough for what im looking for..

Thanks guys!

Link to comment
Share on other sites

2 minutes ago, JohnnyL said:

And i saw some modules in the marketplace but all are outdated 😕 so meh, not going to try them, probably not getting maintenance anyway so thats out.

did you see the "Auto Login From Mails" addon module in Marketplace ? it's listed as being v7.7 compatible and costs €20.

Quote

This module does provide Auto-Login Links for your WHMCS mails. You can modify your existing links by just adding {$modautologin} to authenticate the user automatically when he opens a link to an invoice or other pages. The authentication does work for every WHMCS page (custom module pages too) and the module has a lot of configurable options to meet every use purpose. This can be useful for let your clients show the invoice directly or to increase the ticket feedback rate.

there's a 3-day trial version available from their site if you want to try before you buy. 🙂

Link to comment
Share on other sites

33 minutes ago, brian! said:

did you see the "Auto Login From Mails" addon module in Marketplace ? it's listed as being v7.7 compatible and costs €20.

there's a 3-day trial version available from their site if you want to try before you buy. 🙂

Hi Brian, fast reply as always :), i just checked it out, but they sell it with an yearly fee... was thinking more for an just 1-time fee.. if there aint any free solutions out there..

Lets see if there any other replys by users that can suggest something alternatively.

Thanks !

Link to comment
Share on other sites

51 minutes ago, JohnnyL said:

Hi Brian, fast reply as always :),

you caught me while I was logged in and replying to other threads. 🙂

51 minutes ago, JohnnyL said:

i just checked it out, but they sell it with an yearly fee... was thinking more for an just 1-time fee..

the developers are probably covering themselves just in case WHMCS releases something that breaks how the addon works and it needs to be updated.

51 minutes ago, JohnnyL said:

if there aint any free solutions out there..

you don't watch much do you? 🤑

as a free alternative, how about this WHMCS Auto Auth GitHub solution...

Quote

This script was made to allow end users of WHMCS to login to their accounts automatically. You would add the provided code into your email templates and create a temporary link for your clients to access their invoices, quotes and general login.

the code is only 4 months old and is marked compatible with v7.7.1

Quote

Confirmed working with WHMCS

We have tested this script with the following versions.

  • 5.3.6
  • 6.1.1
  • 6.2.0
  • 7.0.1
  • 7.2.2
  • 7.5.2
  • 7.6
  • 7.7.1-release.1

i've never tried it, but the code looks basically sound to me and I can see no reason why it wouldn't work... though installation and configuration is possibly slightly more involved than using an off-the-shelf solution....

if you try it and it works, let the rest of us know! ☺️

Edited by brian!
Link to comment
Share on other sites

5 minutes ago, brian! said:

ok - this does work in v7.7.1, but it took some effort. 😅

ahh, yea i was about to read it and try it out, but the english is bad in the post lol had to re-read twice,

did you manage to fix it? What about the link not being expired? Can we add a time stamp to it like, 20 days? And what happens if the email address, or password is changed?

Honestly my guess is the other 'paid' modules are the same, but build a bit fancier with some GUI options inside them. what are your thoughts on that,,

Edited by JohnnyL
Link to comment
Share on other sites

3 minutes ago, JohnnyL said:

did you manage to fix it?

I was getting nowhere with it, and then I found the issues thread below from the GitHub page and used that as a walkthrough - for simplicity I just copied the autokey & secretkey posted in the thread - for a live site, you should generate 2 new hashes.

https://github.com/JonTheWong/whmcs-autoauth-invoice/issues/12

Quote
  • Should i copy $email.$timestamp.$autoauthkey and paste it there and then create a hash?

No you use 2 of these hashes
One as system key, and one as secret key

iauth.php example:


Generate a hash and enter it in configuration.php above the last ?>
$autoauthkey = "MD5 hash 1";

$autoauthkey = "MD5 hash 1"; /* same as in configuration.php */
$secretkey = "MD5 hash 2"; /* generate a new key for this script */

Then add this value to the top of your email template;
{assign var='hash' value=$client_email|cat:"MD5 hash 2"}

Then add this link anywhere in your email template.
Login Auth: {$whmcs_url}lauth.php?email={$client_email}&zmkey={$hash|md5}

Alright, so as an example this is how it should look like:


$whmcsurl = "https://xxxxx.se/whmcs/dologin.php"; /* replace with your url /
$autoauthkey = "90b913cc3af373dfb391eceffb054dc7"; / same as in configuration.php /
$secretkey = "5804b18e26f29e115eeeb3a472ec1e7b"; / generate a new key for this script */

if (md5($_GET['email'].$secretkey) != $_GET['zmkey'])
die('Något har blivit fel, vänligen kontakta oss via info@webbsnacks.se för att få hjälp med problemet.');

$email = $_GET['email'];
$timestamp = time();
$hash = sha1($email.$timestamp.$autoauthkey);
$goto = "viewinvoice.php?id=".$_GET['invoice'];

$url = $whmcsurl."?email=$email&timestamp=$timestamp&hash=$hash&goto=".urlencode($goto);
header("Location: $url");
exit;
?>

 

8 minutes ago, JohnnyL said:

What about the link not being expired? Can we add a time stamp to it like, 20 days?

not without some additional coding - probably best to ask the developer about that in the GitHub issues page, but as he says himself - "its a known bug as of now, the only solution is to change the secret key and force an expire on old emails."

I know on the commercial product I linked to first, that has the option to expire links after x hours.

16 minutes ago, JohnnyL said:

And what happens if the email address, or password is changed?

with the GitHub code, I think it would fail if the email address was changed - password change should be irrelevant though.

16 minutes ago, JohnnyL said:

Honestly my guess is the other 'paid' modules are the same, but build a bit fancier with some GUI options inside them. what are your thoughts on that,,

I wouldn't argue with that - but they've probably done the work to fix the gaps in these free solutions - the original code behind that GitHub project goes back to at least 2012, so that's possibly the starting point for most of these solutions.

another GitHub option, but this time as a hook...

https://github.com/wifidel/whmcs-autologin-email

Quote

This is an adaptation of the code provided by WHMCS at https://docs.whmcs.com/AutoAuth
You must upload the mail-auto-login.php file in the path /includes/hooks of your WHMCS.
You must include $ autoauthkey = "here a safe key"; in the WHMCS configuration.php file
Once this is done you can show the link by adding {$ linkauto} in any of the email templates specified in the mail-auto-login.php file
IMPORTANT: This link gives full access to the client area. USE IT AT YOUR RESPONSIBILITY.
NOTE: According to WHMCS the link is only valid for 15 minutes once it is generated.

it makes the mergefield {$linkauto} available to the 2 Invoice Created and the Payment Reminder emails - it's much simpler as you only have to add the key to the configuration file, the hook file and add the link in the email template... it does work - without the need to add Smarty variable assignations and Smarty security policy.

but to be honest, if you need the links to last only a certain number of hours, then it might just be easier to bite the bullet and buy a commercial solution... or at least that free trial.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated