ruby on rails 4 - how to verify email through link in rails4 application -


how verify email through link.

i have user edit profile , showing user email.i want give 1 link verify email.i not do.

add 1 column your

user model : email_verification , default set 0 (0).

then using persistence_token create url , sent specific email address. if dnt have persistence_token column in user model can add custom column of choice verify_email_token column name , stored 50 random string.

using

o =  [('a'..'z'),('a'..'z'),('0'..'9')].map{|i| i.to_a}.flatten string  =  (0...50).map{ o[rand(o.length)] }.join 

url example : http://www.yoursitename.com/verifyemailaddress/?token=persistence_token ;

when user click on link, internally call function verifyemailaddress , in method update email_verification column 1 (1).


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -