Skip to content

Commit

Permalink
Breaking change: Authlogic::Random: Method visibility
Browse files Browse the repository at this point in the history
Methods in Authlogic::Random are now module methods, and are no
longer instance methods. Previously, there were both. Do not use
Authlogic::Random as a mixin.
  • Loading branch information
jaredbeck committed Nov 8, 2017
1 parent 8250b15 commit 5efdcd9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Expand Up @@ -82,3 +82,8 @@ Style/BlockDelimiters:
# the compact style.
Style/ClassAndModuleChildren:
EnforcedStyle: nested

# Both `module_function` and `extend_self` are legitimate. Most importantly,
# they are different (http://bit.ly/2hSQAGm)
Style/ModuleFunction:
Enabled: false
7 changes: 0 additions & 7 deletions .rubocop_todo.yml
Expand Up @@ -52,13 +52,6 @@ Style/MixinUsage:
Exclude:
- 'lib/authlogic/acts_as_authentic/base.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: module_function, extend_self
Style/ModuleFunction:
Exclude:
- 'lib/authlogic/random.rb'

# Offense count: 3
Style/MultilineTernaryOperator:
Exclude:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,9 @@
* 'httponly' and 'secure' cookie options are enabled by default now
* maintain_sessions config has been removed. It has been split into 2 new options:
log_in_after_create & log_in_after_password_change (@lucasminissale)
* Methods in Authlogic::Random are now module methods, and are no longer
instance methods. Previously, there were both. Do not use Authlogic::Random
as a mixin.

* Added
* Support for ruby 2.4, specifically openssl gem 2.0
Expand Down
6 changes: 2 additions & 4 deletions lib/authlogic/random.rb
Expand Up @@ -3,15 +3,13 @@
module Authlogic
# Generates random strings using ruby's SecureRandom library.
module Random
extend self

def hex_token
def self.hex_token
SecureRandom.hex(64)
end

# Returns a string in base64url format as defined by RFC-3548 and RFC-4648.
# We call this a "friendly" token because it is short and safe for URLs.
def friendly_token
def self.friendly_token
SecureRandom.urlsafe_base64(15)
end
end
Expand Down

0 comments on commit 5efdcd9

Please sign in to comment.