sign in user when token is fetched

This commit is contained in:
Bilal
2020-08-03 14:13:49 +02:00
parent 9cbd8d31a8
commit 566f8dae05
2 changed files with 15 additions and 17 deletions

View File

@@ -1,5 +1,8 @@
class Api::UserTokenController < Knock::AuthTokenController
include Oath::ControllerHelpers
skip_before_action :verify_authenticity_token
before_action :sign_in_user
rescue_from Exception, :with => :return_error
@@ -10,7 +13,7 @@ class Api::UserTokenController < Knock::AuthTokenController
logger.error "==Handled======="
logger.error exception.message
logger.error exception.backtrace.join("\n")
logger.error "==Handled======="
logger.error "==Handled======="
case exception
when ActiveRecord::RecordNotFound
@status = 404
@@ -27,12 +30,18 @@ class Api::UserTokenController < Knock::AuthTokenController
end
# for some reason render json_errors is not working
# simulating JSON API support
render json: {
# simulating JSON API support
render json: {
errors: [{
status: @status.to_s,
title: @message
}]
}
end
private
def sign_in_user
sign_in(entity)
end
end

View File

@@ -9,20 +9,6 @@ SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: -
--
@@ -1475,6 +1461,7 @@ CREATE TABLE public.settings (
--
CREATE SEQUENCE public.settings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -1510,6 +1497,7 @@ CREATE TABLE public.taggings (
--
CREATE SEQUENCE public.taggings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -1540,6 +1528,7 @@ CREATE TABLE public.tags (
--
CREATE SEQUENCE public.tags_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE