Sha256: 62f872e4b24ad4bd2ca53b7d51902d81b5d0b02641bb91803c4f3c4d26c66099
Contents?: true
Size: 1.94 KB
Versions: 10
Compression:
Stored size: 1.94 KB
Contents
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>generate_security_token (User)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File app/models/user.rb, line 74</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate_security_token</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">security_token</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">token_expiry</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> (<span class="ruby-constant">Clock</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">token_lifetime</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span>) <span class="ruby-operator">>=</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">token_expiry</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-identifier">token</span> = <span class="ruby-identifier">new_security_token</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">token</span> <span class="ruby-keyword kw">else</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">security_token</span> <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">end</span></pre> </body> </html>
Version data entries
10 entries across 5 versions & 1 rubygems