This modules works correctly if i use the button in the profile page. HOwever, i want to fill out a form with name and email and use rules to send the link to the email address in the form. I have not discovered how to do this. Is this possible?

Comments

stewart.adam’s picture

I don't know how you'd like to go about achieving the form part, but Rules integration is working for me by using the 'Send Mail' system action and entering [account:login-one-time] in the message body.

You may want to look into webform (7.x-4.x branch) if you want a form that has an email callback and token support.

dlaidig’s picture

I am able to get the email to send via rules, but i cannot get a link to view the node. [account:login-one-time] just produced a blank email. Is there any documentation of correct syntax to use for including a Login One Time url? I want to use a predefined role to be used.

dlaidig’s picture

I tried to send an email using the rules "Execute PHP code" after the webform is completed. The email is sent with a link however i get an error message saying "You have tried to use a one-time login link which has been used. Please use the log in form to supply your username and password." I am trying to have an anonymous user complete a webform and be sent an email with the same credentials as the $account listed in the code. Below is my code:

$account->name = 'admin';
$account->pass = 'test';
$account->uid = '1';
$account->mail = 'test@example.com';
$account->status = 1;
// 3 and 2 are role id's
$roles = array(3 => true, 2 => true);
$account->roles = $roles;
login_one_time_send_mail($account, $path = NULL);
dlaidig’s picture

is there a better way to do this? All i want to do is have an anonymous user request a link to access the site with the same security permissions/roles of an existing user.

stewart.adam’s picture

Tokenauth (https://drupal.org/project/tokenauth) is probably better suited for your use case then. It allows users to login immediately using a token in the request URL.