Closed (fixed)
Project:
Login one time
Version:
6.x-1.2
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Aug 2009 at 19:59 UTC
Updated:
25 Sep 2009 at 10:30 UTC
I need to be able to allow a user to request a one time login link in place of logging in with a username and password. How could I allow an anonymous user to type a valid account email address into a text field and then hit a button to have a login link sent to that email account? At the time the page is generated the current user is anonymous. Is there a way I can lookup the email address that is entered by the user and if it is valid then use the API of this module to send a link to THAT account? The user would just get back a Thank You message and would not be logged in until they click on the link sent to them by this module.
Thanks
Dano
Comments
Comment #1
danielb commentedYeah the user_load() function allows you to load like that
$account = user_load(array('mail' => 'email@address.here'));
You'll need to check the $user is not FALSE, then use the function from this module: login_one_time_send_mail().
Comment #2
danielb commentedComment #3
dano commentedThanks for the quick response. I have been struggling with this trying to get it to work with no success. I am collecting an email address in $email and using the user_load to fetch the user object for that email and then use that to call the login_one_time_send_mail(). I end up with an error that says "Unable to send e-mail. Please contact the site administrator if the problem persists."
Log in one time works ok when I click on the normal button in another users account page but not when I call it manually here.
Any ideas? I am desperate! :-)
Here is my code BTW: I can echo $email and it is getting passed properly from the form. Also user_load is accepting it just fine. The error comes when I call the login_onetime function.
Comment #4
danielb commentedtry
login_one_time_send_mail($myuser, $_GET['q']);Comment #5
danielb commented