Bläddra i källkod

Disable API access when login is disabled (#7289)

master
Eugen Rochko 6 år sedan
committed by GitHub
förälder
incheckning
f62ee1ddb0
Ingen känd nyckel hittad för denna signaturen i databasen GPG-nyckel ID: 4AEE18F83AFDEB23
1 ändrade filer med 3 tillägg och 1 borttagningar
  1. +3
    -1
      app/controllers/api/base_controller.rb

+ 3
- 1
app/controllers/api/base_controller.rb Visa fil

@@ -66,8 +66,10 @@ class Api::BaseController < ApplicationController
end

def require_user!
if current_user
if current_user && !current_user.disabled?
set_user_activity
elsif current_user
render json: { error: 'Your login is currently disabled' }, status: 403
else
render json: { error: 'This method requires an authenticated user' }, status: 422
end


Laddar…
Avbryt
Spara