diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb index ce19773e0..17ceb3e2c 100644 --- a/app/controllers/registrar/sessions_controller.rb +++ b/app/controllers/registrar/sessions_controller.rb @@ -146,6 +146,6 @@ class Registrar::SessionsController < Devise::SessionsController def check_ip return if WhiteIp.registrar_ip_white?(request.ip) - render text: t('ip_is_not_whitelisted') and return + render text: t('access_denied') and return end end diff --git a/app/controllers/registrar_controller.rb b/app/controllers/registrar_controller.rb index 8da12c3c1..06e27a37f 100644 --- a/app/controllers/registrar_controller.rb +++ b/app/controllers/registrar_controller.rb @@ -13,7 +13,7 @@ class RegistrarController < ApplicationController def check_ip return unless current_user return if current_user.registrar.registrar_ip_white?(request.ip) - flash[:alert] = t('ip_is_not_whitelisted') + flash[:alert] = t('access_denied') sign_out(current_user) redirect_to registrar_login_path and return end diff --git a/config/locales/en.yml b/config/locales/en.yml index c3bd4256e..33bf0d01b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -796,3 +796,4 @@ en: registrant_domain_verification_rejected: 'Domain owner change has been rejected successfully.' registrant_domain_verification_rejected_failed: 'Something went wrong' ip_is_not_whitelisted: 'IP is not whitelisted' + access_denied: 'Access denied' diff --git a/db/seeds.rb b/db/seeds.rb index 3ee57babd..3b4cef281 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -44,7 +44,6 @@ ApiUser.where( admin1 = { username: 'user1', password: 'testtest', - password_confirmation: 'testtest', email: 'user1@example.ee', identity_code: '37810013855', country_code: 'EE' @@ -52,7 +51,6 @@ admin1 = { admin2 = { username: 'user2', password: 'testtest', - password_confirmation: 'testtest', email: 'user2@example.ee', identity_code: '37810010085', country_code: 'EE' @@ -60,7 +58,6 @@ admin2 = { admin3 = { username: 'user3', password: 'testtest', - password_confirmation: 'testtest', email: 'user3@example.ee', identity_code: '37810010727', country_code: 'EE' @@ -69,7 +66,7 @@ admin3 = { [admin1, admin2, admin3].each do |at| admin = AdminUser.where(at) next if admin.present? - admin = AdminUser.new(at) + admin = AdminUser.new(at.merge({ password_confirmation: 'testtest' })) admin.roles = ['admin'] admin.save end diff --git a/spec/features/registrar/sessions_spec.rb b/spec/features/registrar/sessions_spec.rb index e969d507d..4a5c19a84 100644 --- a/spec/features/registrar/sessions_spec.rb +++ b/spec/features/registrar/sessions_spec.rb @@ -5,7 +5,7 @@ feature 'Sessions', type: :feature do it 'should not see login page' do WhiteIp.destroy_all visit registrar_login_path - page.should have_text('IP is not whitelisted') + page.should have_text('Access denied') end it 'should see log in' do @@ -23,7 +23,7 @@ feature 'Sessions', type: :feature do fill_in 'depp_user_tag', with: @api_user_invalid_ip.username fill_in 'depp_user_password', with: @api_user_invalid_ip.password click_button 'Log in' - page.should have_text('IP is not whitelisted') + page.should have_text('Access denied') end end