Commit 0bdede66 by liyijie

Add auth to current_authable after auth!

parent e0f1c546
...@@ -5,7 +5,7 @@ module RailsApiAuthentication ...@@ -5,7 +5,7 @@ module RailsApiAuthentication
DIGEST = Digest::SHA2.new DIGEST = Digest::SHA2.new
included do included do
attr_accessor :token attr_accessor :token, :auth
def logout def logout
AuthToken.find(token: token)&.first&.delete if token.present? AuthToken.find(token: token)&.first&.delete if token.present?
...@@ -151,6 +151,7 @@ module RailsApiAuthentication ...@@ -151,6 +151,7 @@ module RailsApiAuthentication
else else
user = self.find_by(id: auth.oid) user = self.find_by(id: auth.oid)
user.token = auth.token user.token = auth.token
user.auth = auth
user user
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment