Ruby On Rails Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2|
Lessons:- A Working sign in Method

 

This pattern of setting a cookie that expires 20 years in the future became so common that Rails added a special permanent method to implement it, so that we can simply write

cookies.permanent  [:remember token] =  user.remember token

 

Under the hood, using permanent causes Rails to set the expiration to 20.years. from_now automatically.   After the cookie is set, on subsequent page views we can retrieve the user with code like

User . find by remember token(cookies [ :remember token ] )

 

Of course, cookies isn’t really a hash, since assigning to cookies actually saves a piece of text on the browser, but part of the beauty of Rails is that it lets you forget about that detail and concentrate on writing the application.

            You may be aware that storing authentication cookies on a user’s browser and transmitting them over the network exposes an application to a session hijacking attack, which involves copying the remember token and using it to sign in as the corresponding user. This attack was publicized by the Firesheep application, which showed that many high-profile sites (including Facebook and Twitter) were vulnerable. The solution is to use site-wide SSL as described in Section 7.4.4.  

 
 
 
image
Anil  Bist

Skills    Ruby On Rails

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)