diff --git a/app/controllers/repp/v1/registrar/login_controller.rb b/app/controllers/repp/v1/registrar/login_controller.rb index e487d480e..7ecddd1db 100644 --- a/app/controllers/repp/v1/registrar/login_controller.rb +++ b/app/controllers/repp/v1/registrar/login_controller.rb @@ -6,7 +6,7 @@ module Repp desc 'check login user and return data' def index - @login = current_user + @login = current_user.registrar # rubocop:disable Style/AndOr render_success(data: nil) and return unless @login diff --git a/test/integration/repp/v1/registrar/login_test.rb b/test/integration/repp/v1/registrar/login_test.rb index d210a7848..354e66406 100644 --- a/test/integration/repp/v1/registrar/login_test.rb +++ b/test/integration/repp/v1/registrar/login_test.rb @@ -3,6 +3,7 @@ require 'test_helper' class ReppV1LoginTest < ActionDispatch::IntegrationTest def setup @user = users(:api_bestnames) + @registrar = @user.registrar token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}") token = "Basic #{token}" @@ -14,8 +15,8 @@ class ReppV1LoginTest < ActionDispatch::IntegrationTest json = JSON.parse(response.body, symbolize_names: true) assert_response :ok - assert_equal json[:data][:username], @user.username - assert_equal json[:data][:identity_code], @user.identity_code + assert_equal json[:data][:email], @registrar.email + assert_equal json[:data][:id], @registrar.id end def test_invalid_login