Hi - AFAICT the [user:one-time-login-url] is required for a successful user login in D7.
However, this token is not exposed on admin/commerce/config/email, so there's no way to get a newly-created-by-checkout Commerce user logged in. On order creation an anon user gets a new account created for them (without a password assigned) and they get an email. They'll never be able to log in without this token being provided in the email, right?

Implementation
As stated in #1289898-9: Action: Generate a one-time-login-url providing the one-time-login-url as token will NOT get committed, because it has the security implication "use tokens" >= "takeover any account" which is not wanted.
The solution is to roll a tiny module "get onetime login link as variable".
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | user_token_not_available-1430694-2.patch | 669 bytes | guillaumev |
| rfay_screenshot 2012-02-06 at 4.17.08 PM.png | 200.29 KB | rfay |
Comments
Comment #1
guillaumev commentedI'm changing the project name of this issue because it really affects Variable Email (since Commerce Email is using Variable Email to send the emails).
I had this issue and if you look in the file variable_email.rules.inc, you will find some code commented out which allows you to have the user:one-time-login-url token available. This code is commented out, however, because it introduces security issues which are discussed further here: http://drupal.org/node/1289898. As long as this issue is not fixed, I won't be able to have this code in variable_email. However, you can, if you understand the security risks, uncomment this line of code I'm talking about...
Comment #2
guillaumev commentedHere is a patch to uncomment the lines of code, however, this patch won't be committed :-)
Comment #3
summit commentedHi, if this patch is not committed what is then the best solution?|
greetings, Martijn
Comment #4
modctek commentedWhere are we on this issue? I've tried uncommenting the code mentioned above, but the Tokens aren't surfacing. Do I need to patch Rules as well? This seems to be fairly important.
Comment #5
Horroshow commentedThis is a serious problem for us. Could I replace [user:one-time-login-url] with [current-user:login-one-time] as a workaround?
Comment #6
Horroshow commentedI'm replying to this post again because I have potential customers who cannot login after ordering. I think this is a critical issue.
Any help would be appreciated.
Comment #7
stewart.adam commentedFor those using this patch, be sure that you are literally using
[user:one-time-login-url]. Using anything else such as[account:one-time-login-url]won't work.I've looked in the code and despite the user prefix, my understanding is that this token is substituted just as it would normally for $account. This is due to a quirk in the way user_mail_tokens() substitutes the tokens.
Comment #7.0
stewart.adam commentedAdded some detail.
Comment #8
geek-merlinUpdated issue summary.
>The solution is to roll a tiny module "get onetime login link as variable".
That's just about 20 lines of code.
Comment #9
stewart.adam commentedUnless I'm mistaken, I do not think that it is currently possible to put in a custom module. There are no hooks to extend variable_email's token processing and implementing hook_mail_alter to replace the additional tokens after the fact is a bit of a stretch since the $account object is never passed. In theory you could try loading the users object by their email, but I feel like that's just clunky.
Unless I've missed something?
Comment #9.0
stewart.adam commentedUpdated
Comment #10
geek-merlin#9: please read #1289898-7: Action: Generate a one-time-login-url where fago puts it plain:
the plan is to have an action "generate onetimeloginurl" which provides this as a text variable.
the text variable is then accessible as a token.
;-)
Comment #11
stewart.adam commentedThat was nearly two years ago... I don't think that's happening anytime soon :/
Comment #12
geek-merlinIt will happen as soon as anyone spends the 2 hours (or pays someone doing it) which can be today.
Comment #13
shaneonabike commentedI think removing this code ALSO causes an issue with the normal user login link. SO I changed my email message to tell people just to request a new password but now those variables are never set properly due to this change? Or is this another bug...
Comment #14
Horroshow commented#10 There's a patch available now. I didn't test it yet. https://drupal.org/node/1289898#comment-7842483
Comment #15
xurizaemonSee #1430694: [user:one-time-login-url] is not available on config page, so new user cannot log in. Note that the fix in that issue requires uncommenting a couple of lines.
Comment #15.0
xurizaemonUpdated issue summary.
Comment #16
vvs commented#15 Please correct issue number. This issue is duplicate to self?
Comment #17
giorgoskThis is still active to my understanding
some people call duplicate but don't provide the duplicate thread
so this is still active
solutions above are workarounds at best
Comment #18
xurizaemonSorry, that should have linked to #1289898: Action: Generate a one-time-login-url which this issue is a duplicate of.
From this issue's description -
That module I think is in the linked issue. Marking duplicate again (you're free to undo this if you feel it's appropriate).