HI,

i had a similar problem. I needed an confimation email, in that email
i supplied a link for confirmation,
after that the user should be logged in. So its similar of your
problem.

First u need the following:

A unique link, like an email_token, md5 hash of an email and a
timestamp in example.
Save this token in the userdb allong with the clearpassword of the
user.

So the needed fields would be like this:

username
pwd (md5 hashed)
pwd_temp (password in cleartext)
email_token (must be unique)

Your link would be like that

http://yourDomain.com/Modules/actions/emailtoken

in your action you just query after that token.
$condition = array('Users.email_token = $emailtoken');
Get the data, an temp var like $temp = $this->User->find($condition);

Then you clear the array with $this->data = array();
This is important, because othAuth tries to rehash the hashed pwd, and
the login will fail.
$login['username']  = $temp['username'];
$login['password']  = $temp['pwd'];
Then authenticate the user with the $this->othAuth($login);
Like you would do with the normal loginform.
Notice: username and password field must be the same you specified in
the othAuth component.
And don't forget to include othAuth in your component var.

Then your user should be logged in.
I didn't found an another solution than storing the pwd in cleartext
in the db.
I only used it once for the confirmation email.
And then i cleared it for security reasons.

I hope this will help you a bit to get your problem solved.

Sorry for my bad language.

greetings Hawk|-

P.S.: Ask me if you need more details.


On 20 Mrz., 00:00, "Bootstrapper" <[EMAIL PROTECTED]>
wrote:
> How can you construct a link from an email that automatically logs the
> user in to a cake site and links to the right action?
>
> I'm sending update emails to users, and if they want to do anything
> with their account, I want them to be able to access the relevant page
> directly with one click on a link from the email. I expect you can
> embed the login and password into the email, but I haven't been able
> to figure out how.
>
> I'm using OthAuth.
>
> Anyone have any ideas?
>
> Many thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to