storefront/app/controllers/workarea/api/storefront/authentication.rb in workarea-api-4.4.7 vs storefront/app/controllers/workarea/api/storefront/authentication.rb in workarea-api-4.5.0

- old
+ new

@@ -8,22 +8,19 @@ included do helper_method :current_user end - def current_user - return @current_user if defined?(@current_user) + def self.find_user(token, options) + User::AuthenticationToken.authenticate(token, options).try(:user) + end - user = authenticate_with_http_token do |token, options| - User::AuthenticationToken.authenticate(token, options).try(:user) - end - - @current_user = user || raise(InvalidError) + def current_user + current_visit.current_user || raise(InvalidError) end def authentication? - regex = ActionController::HttpAuthentication::Token::TOKEN_REGEX - request.authorization.to_s[regex].present? + current_visit.logged_in? end end end end end