From 7ba5b3b2ae74992aa1a4112848c37911d40d27b5 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Fri, 13 Sep 2019 17:10:08 +0300 Subject: [PATCH] Refactor EPP login password change --- app/controllers/epp/sessions_controller.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/epp/sessions_controller.rb b/app/controllers/epp/sessions_controller.rb index e84659c86..6c3509786 100644 --- a/app/controllers/epp/sessions_controller.rb +++ b/app/controllers/epp/sessions_controller.rb @@ -87,10 +87,11 @@ module Epp end if success - if params[:parsed_frame].css('newPW').first - unless @api_user.update(plain_text_password: params[:parsed_frame].css('newPW').first.text) - handle_errors(@api_user) and return - end + new_password = params[:parsed_frame].at_css('newPW')&.text + + if new_password.present? + @api_user.plain_text_password = new_password + @api_user.save! end epp_session = EppSession.new