Welcome Guest, Not a member yet? Register   Sign In
General design question
#1

[eluser]bennyhill[/eluser]
When you sign up for a new user account for a forum, it sends you and email telling you to click a link to activate your account. What is going on in the background with the database? Do you just send the link to a function in a controller and then change a field in a record set, say to, "authorized" ? Basically I am just wondering how to construct this functionality of authorizing accounts (changing a database entry) via a link in an email.
#2

[eluser]bretticus[/eluser]
I typically generate a GUID (random string that I hash.) The CI string class has a random_string() function that is useful or you can use the database to generate something for you. I store that with the new user's pending record in the database. Then I send them the link. The link is a reference to a controller/method with the GUID tacked on the end (ie. http://mysite.tld/users/confirm/2u43h5kj2k35hkjh3456.) The next step is checking that GUID in the database and changing the user record from pending to confirmed (or however you want to represent these states.)

That's it in a nutshell.
#3

[eluser]bennyhill[/eluser]
Great thanks for the quick response.




Theme © iAndrew 2016 - Forum software by © MyBB