mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Add IP block on authentication via EID
Also, correct mistakenly used 403 error code. Update aplication-example.yml to include new functionality.
This commit is contained in:
parent
8f234a5852
commit
42004f933f
6 changed files with 42 additions and 6 deletions
|
@ -7,6 +7,13 @@ module Api
|
|||
class BaseController < ActionController::API
|
||||
before_action :authenticate
|
||||
|
||||
rescue_from(ActionController::ParameterMissing) do |parameter_missing_exception|
|
||||
error = {}
|
||||
error[parameter_missing_exception.param] = ['parameter is required']
|
||||
response = { errors: [error] }
|
||||
render json: response, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def bearer_token
|
||||
|
@ -22,7 +29,7 @@ module Api
|
|||
if decryptor.valid?
|
||||
sign_in decryptor.user
|
||||
else
|
||||
render json: { error: 'Not authorized' }, status: 403
|
||||
render json: { error: 'Not authorized' }, status: 401
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue