Enable Rubocop HTTP status rules (#23717)
This commit is contained in:
@ -30,7 +30,7 @@ class Api::V1::AccountsController < Api::BaseController
|
||||
self.response_body = Oj.dump(response.body)
|
||||
self.status = response.status
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
render json: ValidationErrorFormatter.new(e, 'account.username': :username, 'invite_request.text': :reason).as_json, status: :unprocessable_entity
|
||||
render json: ValidationErrorFormatter.new(e, 'account.username': :username, 'invite_request.text': :reason).as_json, status: 422
|
||||
end
|
||||
|
||||
def follow
|
||||
|
@ -15,10 +15,10 @@ class Api::V1::Emails::ConfirmationsController < Api::BaseController
|
||||
private
|
||||
|
||||
def require_user_owned_by_application!
|
||||
render json: { error: 'This method is only available to the application the user originally signed-up with' }, status: :forbidden unless current_user && current_user.created_by_application_id == doorkeeper_token.application_id
|
||||
render json: { error: 'This method is only available to the application the user originally signed-up with' }, status: 403 unless current_user && current_user.created_by_application_id == doorkeeper_token.application_id
|
||||
end
|
||||
|
||||
def require_user_not_confirmed!
|
||||
render json: { error: 'This method is only available while the e-mail is awaiting confirmation' }, status: :forbidden unless !current_user.confirmed? || current_user.unconfirmed_email.present?
|
||||
render json: { error: 'This method is only available while the e-mail is awaiting confirmation' }, status: 403 unless !current_user.confirmed? || current_user.unconfirmed_email.present?
|
||||
end
|
||||
end
|
||||
|
@ -52,9 +52,9 @@ class Auth::SessionsController < Devise::SessionsController
|
||||
|
||||
session[:webauthn_challenge] = options_for_get.challenge
|
||||
|
||||
render json: options_for_get, status: :ok
|
||||
render json: options_for_get, status: 200
|
||||
else
|
||||
render json: { error: t('webauthn_credentials.not_enabled') }, status: :unauthorized
|
||||
render json: { error: t('webauthn_credentials.not_enabled') }, status: 401
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -57,10 +57,10 @@ module TwoFactorAuthenticationConcern
|
||||
|
||||
if valid_webauthn_credential?(user, webauthn_credential)
|
||||
on_authentication_success(user, :webauthn)
|
||||
render json: { redirect_path: after_sign_in_path_for(user) }, status: :ok
|
||||
render json: { redirect_path: after_sign_in_path_for(user) }, status: 200
|
||||
else
|
||||
on_authentication_failure(user, :webauthn, :invalid_credential)
|
||||
render json: { error: t('webauthn_credentials.invalid_credential') }, status: :unprocessable_entity
|
||||
render json: { error: t('webauthn_credentials.invalid_credential') }, status: 422
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ module Settings
|
||||
|
||||
session[:webauthn_challenge] = options_for_create.challenge
|
||||
|
||||
render json: options_for_create, status: :ok
|
||||
render json: options_for_create, status: 200
|
||||
end
|
||||
|
||||
def create
|
||||
|
Reference in New Issue
Block a user