mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Refactor + tests
This commit is contained in:
parent
dc1ad9e6c5
commit
19e133ec6a
7 changed files with 37 additions and 25 deletions
|
@ -18,7 +18,7 @@ class Epp::SessionsController < EppController
|
|||
@api_user = ApiUser.find_by(login_params)
|
||||
end
|
||||
|
||||
if @api_user.try(:active) && cert_valid
|
||||
if @api_user.try(:active) && cert_valid && ip_white?
|
||||
if parsed_frame.css('newPW').first
|
||||
unless @api_user.update(password: parsed_frame.css('newPW').first.text)
|
||||
response.headers['X-EPP-Returncode'] = '2200'
|
||||
|
@ -33,6 +33,17 @@ class Epp::SessionsController < EppController
|
|||
render_epp_response('login_fail')
|
||||
end
|
||||
end
|
||||
|
||||
def ip_white?
|
||||
if @api_user
|
||||
unless @api_user.registrar.epp_ip_white?(request.ip)
|
||||
@msg = t('ip_is_not_whitelisted')
|
||||
return false
|
||||
end
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue