diff --git a/src/lib/registration/ui/base_system_registration_dialog.rb b/src/lib/registration/ui/base_system_registration_dialog.rb index da5fe6cfe..0aaa0885d 100644 --- a/src/lib/registration/ui/base_system_registration_dialog.rb +++ b/src/lib/registration/ui/base_system_registration_dialog.rb @@ -65,6 +65,9 @@ def run Yast::GetInstArgs.enable_next || Yast::Mode.normal ) + # Limit the reg_code InputField to 512 (bsc#1098576) + Yast::UI.ChangeWidget(:reg_code, :InputMaxLength, 512) + # Set default action self.action = initial_action set_focus diff --git a/test/base_system_registration_dialog_test.rb b/test/base_system_registration_dialog_test.rb index 7c28bfae9..0a7bb3755 100644 --- a/test/base_system_registration_dialog_test.rb +++ b/test/base_system_registration_dialog_test.rb @@ -32,6 +32,7 @@ allow(Yast::Mode).to receive(:mode).and_return(mode) allow(Registration::Registration).to receive(:is_registered?).and_return(registered?) allow(Registration::UrlHelpers).to receive(:slp_discovery_feedback).and_return([]) + allow(Yast::UI).to receive(:ChangeWidget) end context "when system is not registered" do @@ -44,6 +45,14 @@ allow(Registration::Helpers).to receive(:reset_registration_status) end + it "limits the reg_code InputField to 512" do + allow(subject).to receive(:event_loop).and_return(nil) + + expect(Yast::UI).to receive(:ChangeWidget).with(:reg_code, :InputMaxLength, 512) + + subject.run + end + context "when user enters a correct regcode" do it "registers the base system with provided email and reg. code" do expect(Yast::UI).to receive(:QueryWidget).with(:email, :Value)