From b9326ab444c99623485f040e1bffe72dba256742 Mon Sep 17 00:00:00 2001 From: Wedge Date: Fri, 25 Mar 2016 14:02:16 +0300 Subject: [PATCH] Added user/pw auth to api back --- app/controllers/api/v1/base_controller.rb | 8 -------- app/controllers/api/v1/users_controller.rb | 2 -- 2 files changed, 10 deletions(-) diff --git a/app/controllers/api/v1/base_controller.rb b/app/controllers/api/v1/base_controller.rb index 1f6b9c15d..abbe2090a 100644 --- a/app/controllers/api/v1/base_controller.rb +++ b/app/controllers/api/v1/base_controller.rb @@ -16,14 +16,6 @@ class Api::V1::BaseController < ApplicationController protected def check_auth - authenticate_or_request_with_http_basic do |token,pw| - if user = User.find_by_authentication_token(token) - sign_in user, false - end - end - end - - def check_auth_pw_or_token authenticate_or_request_with_http_basic do |username,pw| if user = User.auth_by_token_or_login_pass(username, pw) sign_in user, false diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 28c294aaf..edc125cb4 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -1,8 +1,6 @@ class Api::V1::UsersController < Api::V1::BaseController before_action :authenticate_user! - before_action :check_auth_pw_or_token, only: :show_current_user - skip_before_action :check_auth, only: :show_current_user skip_before_action :check_auth, only: [:show] if APP_CONFIG['anonymous_access'] skip_before_action :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access'] before_action :load_user, only: %i(show)