mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-14 17:27:58 -05:00
This allows us to remove the dependency on the XML serializer provided
by the external `activemodel-serializers-xml` gem, and eliminates the
following deprecation warning:
DEPRECATION WARNING: ActiveModel::Errors#to_xml is deprecated and
will be removed in Rails 6.2.
Please note: this does not mean Devise doesn't support XML, it simply
means our test suite will use JSON to test non-navigatable formats
instead of XML, for simplicity. Devise's job is not to test object
serialization, so as long as your objects properly serialize to
XML/JSON/any other format, it should work out of the box.
35 lines
913 B
Ruby
35 lines
913 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UsersController < ApplicationController
|
|
prepend_before_action :current_user, only: :exhibit
|
|
before_action :authenticate_user!, except: [:accept, :exhibit]
|
|
clear_respond_to
|
|
respond_to :html, :json
|
|
|
|
def index
|
|
user_session[:cart] = "Cart"
|
|
respond_with(current_user)
|
|
end
|
|
|
|
def edit_form
|
|
user_session['last_request_at'] = params.fetch(:last_request_at, 31.minutes.ago.utc)
|
|
end
|
|
|
|
def update_form
|
|
render (Devise::Test.rails5_and_up? ? :body : :text) => 'Update'
|
|
end
|
|
|
|
def accept
|
|
@current_user = current_user
|
|
end
|
|
|
|
def exhibit
|
|
render (Devise::Test.rails5_and_up? ? :body : :text) => current_user ? "User is authenticated" : "User is not authenticated"
|
|
end
|
|
|
|
def expire
|
|
user_session['last_request_at'] = 31.minutes.ago.utc
|
|
render (Devise::Test.rails5_and_up? ? :body : :text) => 'User will be expired on next request'
|
|
end
|
|
end
|