Skip to content

Commit

Permalink
Limit the regcode InputField to 512 (bsc#1098576)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Sep 4, 2018
1 parent 8548311 commit 0b93ff2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/registration/ui/base_system_registration_dialog.rb
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions test/base_system_registration_dialog_test.rb
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 0b93ff2

Please sign in to comment.