corrected err in beforehandler

This commit is contained in:
Paul Liverman III 2018-04-24 07:05:16 -07:00
parent 0753a17796
commit 8c0479d013

View File

@ -13,8 +13,9 @@ class API extends Application
@before_filter( capture_errors_json json_params => @before_filter( capture_errors_json json_params =>
-- TODO implement Authorization: api_key VALUE as acceptable method to send api_key -- TODO implement Authorization: api_key VALUE as acceptable method to send api_key
yield_error "api_key not specified!" unless @params.api_key
@api_key = APIKeys\find key: @params.api_key @api_key = APIKeys\find key: @params.api_key
yield_error "api_key not specified!" unless @api_key yield_error "Invalid api_key" unless @api_key
@user = Users\find id: @api_key.user_id @user = Users\find id: @api_key.user_id
yield_error "Invalid api_key!" unless @user -- NOTE this should also delete the api_key and error (this should never happen!) yield_error "Invalid api_key!" unless @user -- NOTE this should also delete the api_key and error (this should never happen!)
) )