Skip to content

Commit

Permalink
update random class to not include - and _ characters
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Aug 4, 2010
1 parent c52993c commit 086498d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion lib/authlogic/random.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def hex_token

def friendly_token
# use base64url as defined by RFC4648
SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")
SecureRandom.base64(15).tr('+/=', '').strip.delete("\n")
end
else
def hex_token
Expand Down
7 changes: 0 additions & 7 deletions test/random_test.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
require File.dirname(__FILE__) + '/test_helper.rb'

class RandomTest < ActiveSupport::TestCase
def test_random_tokens_have_consisten_length
with_any_random do
assert_equal 128, Authlogic::Random.hex_token.length
assert_equal 20, Authlogic::Random.friendly_token.length
end
end

def test_random_tokens_are_indeed_random
# this might fail if you are *really* unlucky :)
with_any_random do
Expand Down

0 comments on commit 086498d

Please sign in to comment.