Bug 829437 - Hitting enter with blank field for GPG name returns JSON content
Hitting enter with blank field for GPG name returns JSON content
Product: Red Hat Satellite 6
Classification: Red Hat
Component: WebUI (Show other bugs)
Unspecified Unspecified
unspecified Severity high (vote)
: Unspecified
: --
Assigned To: Ivan Necas
Corey Welton
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2012-06-06 14:36 EDT by Corey Welton
Modified: 2014-09-18 11:32 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
GPG key creation with an empty "name" field resulted in JSON text returned on the screen instead of a properly formatted error due to incorrect validation of file uploads. This fix corrects the validation and the error message correctly displays.
Story Points: ---
Clone Of:
Last Closed: 2012-10-24 10:22:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
stack returned when performing this behavior (55.32 KB, text/plain)
2012-09-17 11:37 EDT, Corey Welton
no flags Details

  None (edit)
Description Corey Welton 2012-06-06 14:36:35 EDT
Description of problem:

When  creating a GPG key, if a user hits "enter" on an unpopulated GPG Key name field, JSON text is returned on the screen instead of the expected error message. This does not occur if user hits the submit button.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.  Content Management > Content Providers > GPG Keys > +New GPG Key
2.  Do not enter anything in the Name field; paste some text into the GPG 
3.  Hit the Save button - note the expected error about name validation.
4.  Click into the Name field; do not enter any text and hit Enter/Return

Actual results:
JSON output
{"validation_errors":["Name must contain at least 2 characters","Content can't be blank"],"notices":[]}

Expected results:
The error gets sent/bubbles up to UI as a notification as per any other notification.

Additional info:
The worst part about this bug is that user doesn't seem to be able to hit the back button in the browser a few times to return to the UI - s/he is just bounced back and forth between URLs for 
/cfse/gpg_keys and /cfse/gpg_keys#panel=new, both of which contain the same JSON.
Comment 1 Ivan Necas 2012-07-02 03:19:51 EDT
commit 5ddcc146b787291780c45b0d60778e8226b5fc35
Author: Ivan Necas <inecas@redhat.com>
Date:   Fri Jun 29 14:10:41 2012 +0200

    829437 - handle uploading GPG key when submitting with enter

commit 8ecf419805b3363d0949e3a854ccce542c9184d1
Merge: 163c2af 9c71bc3
Author: Tom McKay <thomasmckay@redhat.com>
Comment 3 Corey Welton 2012-09-17 11:36:50 EDT
Fails in bigger, better ways now :)

Now, when hitting enter in the gpg key name field, a stack is returned - see forthcoming attachment.

CloudForms System Engine Version: 1.1.12-7.el6cf
Comment 4 Corey Welton 2012-09-17 11:37:35 EDT
Created attachment 613714 [details]
stack returned when performing this behavior
Comment 5 Ivan Necas 2012-09-18 06:01:37 EDT
It's connect with 857727, I suggest to disable ignoring enter button entirely in the name field. Reason: from user point of view after entering the name he still needs either enter the key in the text box or select the file. And then he has to press the button according the way he inserts the key. In other words, there is little possibility that hitting enter in the name will be successful (gpg key is blank).

@corey: Would this proposed solution work for you?
Comment 6 Corey Welton 2012-09-18 09:08:03 EDT
We can try that out and see if it remedies the issue; I'll also be checking afterwards to see if I can identify any corner cases where this still might show up.
Comment 7 Ivan Necas 2012-09-21 02:12:21 EDT
It was different issue at the end (wrong handing of validation errors when uploading the file through iframe). Fixed in https://github.com/Katello/katello/pull/693, commit bdb774be54dbbfd84f17cf72ef2b24845c73fb77
Comment 10 Corey Welton 2012-09-25 16:03:08 EDT
QE Verified

CloudForms System Engine Version: 1.1.12-9.el6cf
Comment 11 David Davis 2012-10-09 17:23:54 EDT
*** Bug 859329 has been marked as a duplicate of this bug. ***
Comment 12 Mike McCune 2012-10-24 10:22:07 EDT
closing, currentrelease since these seemingly got missed in the 1.0.1 errata
Comment 13 Mike McCune 2013-08-16 13:57:18 EDT
getting rid of 6.0.0 version since that doesn't exist

Note You need to log in before you can comment on or make changes to this bug.