Skip to content

Commit

Permalink
Move token_randomness config to Model::Config in initializer template (
Browse files Browse the repository at this point in the history
…#375)

Move `token_randomness` config to the user module.
Before it was placed in the template into the controller module, which leads to an error if configured:

```ruby
NoMethodError:
  undefined method `token_randomness=' for module Sorcery::Controller::Config
```
The attribute is part of the `Sorcery::Model::Config` module though: https://github.com/Sorcery/sorcery/blob/d8ce48a407d0b24ed20c8c8bd5010c9b084cd1b0/lib/sorcery/model/config.rb#L41
  • Loading branch information
5minpause authored Sep 23, 2024
1 parent 8b0dce4 commit f979ea4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Remove form_authenticity_token method [#371](https://github.com/Sorcery/sorcery/pull/371)
* Remove legacy Rails version conditionals [#370](https://github.com/Sorcery/sorcery/pull/370)
* Bump up required ruby version to 3.0.0 [#369](https://github.com/Sorcery/sorcery/pull/369)
* Move `token_randomness` config to Model::Config in initializer template [#375](https://github.com/Sorcery/sorcery/pull/375)

## 0.17.0

Expand Down
12 changes: 6 additions & 6 deletions lib/generators/sorcery/templates/initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
#
# config.remember_me_httponly =

# Set token randomness. (e.g. user activation tokens)
# The length of the result string is about 4/3 of `token_randomness`.
# Default: `15`
#
# config.token_randomness =

# -- session timeout --
# How long in seconds to keep the session alive.
# Default: `3600`
Expand Down Expand Up @@ -284,6 +278,12 @@
#
user.stretches = 1 if Rails.env.test?

# Set token randomness. (e.g. user activation tokens)
# The length of the result string is about 4/3 of `token_randomness`.
# Default: `15`
#
# user.token_randomness =

# Encryption key used to encrypt reversible encryptions such as AES256.
# WARNING: If used for users' passwords, changing this key will leave passwords undecryptable!
# Default: `nil`
Expand Down

0 comments on commit f979ea4

Please sign in to comment.