1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

7 commits

Author SHA1 Message Date
Kasper Timm Hansen
1aa1cec777 Revert "Merge pull request #20835 from glittershark/if-and-unless-in-secure-token"
This reverts commit 224eddfc0e, reversing
changes made to 9d681fc74c.

When merging the pull request, I misunderstood `has_secure_token` as declaring a model
has a token from birth and through the rest of its lifetime.

Therefore, supporting conditional creation doesn't make sense. You should never mark a
model as having a secure token if there's a time when it shouldn't have it on creation.
2016-01-14 21:52:03 +01:00
Kasper Timm Hansen
492d203986 Split out token if tests to trigger before_create.
When running passing condition assertions in the same test the user had already
been saved at that point.

Split out so we have a not yet persisted user.

Rename condition tests to improve clarity a bit.
2016-01-09 23:33:57 +01:00
Griffin Smith
21c0a1f301 Support :if and :unless in has_secure_token
Pass through :if and :unless options from has_secure_token to the
generated before_create callback
2016-01-09 14:49:00 -05:00
Wojciech Wnętrzak
0817bb06f7 Do not overwrite secret token value when already present.
```
user = User.create(token: "custom-secure-token")
user.token # => "custom-secure-token"
```
2015-02-12 22:05:45 +01:00
robertomiranda
47316feee0 Switch Secure Token generation to Base58
Update Secure Token Doc [ci skip]

remove require securerandom, core_ext/securerandom already do that ref 7e006057
2015-01-09 18:47:44 -05:00
Jon Atack
2f05036cdd Clean up secure_token_test 2015-01-05 15:41:53 +01:00
robertomiranda
5a58ba3366 Add has_secure_token to Active Record
Update SecureToken Docs

Add Changelog entry for has_secure_token [ci skip]
2015-01-04 11:31:37 -05:00