Skip to content

Commit

Permalink
Removed some useless code.
Browse files Browse the repository at this point in the history
Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>
  • Loading branch information
Yorick Peterse committed Jan 25, 2012
1 parent 561d528 commit b24669f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/ramaze/helper/csrf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def csrf_protection(*methods, &block)
if methods.include?(action.name) or methods.include?(action.name.to_sym)
# THINK: For now the field name is hard-coded to "csrf_token". While
# this is perfectly fine in most cases it might be a good idea
# to allow developers to change the name of this field (for whatever the reason).
# to allow developers to change the name of this field (for whatever
# the reason).
yield unless validate_csrf_token(request.params['csrf_token'])
end
end
Expand Down Expand Up @@ -141,9 +142,6 @@ def generate_csrf_token(args = {})
:host => request.host,
:ttl => ttl
}

# Prevent this method from returning any value (it isn't needed anyway)
return
end

##
Expand All @@ -161,7 +159,6 @@ def get_csrf_token
self.generate_csrf_token
end

# Land ho!
return session[:_csrf][:token]
end

Expand Down Expand Up @@ -194,7 +191,6 @@ def validate_csrf_token(input_token)

_csrf = session[:_csrf]

# Mirror mirror on the wall, who's the most secure of them all?
session[:_csrf][:token] == input_token &&
(Time.now.to_f - _csrf[:time]) <= _csrf[:ttl] &&
_csrf[:host] == request.host &&
Expand Down

0 comments on commit b24669f

Please sign in to comment.