Created
January 4, 2022 23:29
-
-
Save truongnmt/4e3e0c21af2b8122e04176a7dbb63eaa to your computer and use it in GitHub Desktop.
app/models/user.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ApplicationRecord | |
devise :database_authenticatable, :recoverable, :rememberable | |
def authenticatable_salt | |
return super unless session_token | |
"#{super}#{session_token}" | |
end | |
def invalidate_all_sessions! | |
update_attribute(:session_token, SecureRandom.hex) | |
end | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment