Bug 829437

Summary: Hitting enter with blank field for GPG name returns JSON content
Product: Red Hat Satellite Reporter: Corey Welton <cwelton>
Component: WebUIAssignee: Ivan Necas <inecas>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: bkearney, cpelland, dmacpher, inecas, lijli, mmccune, omaciel, snansi
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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: Environment:
Last Closed: 2012-10-24 14:22:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
stack returned when performing this behavior none

Description Corey Welton 2012-06-06 18:36:35 UTC
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 07:19:51 UTC
commit 5ddcc146b787291780c45b0d60778e8226b5fc35
Author: Ivan Necas <inecas>
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>

Comment 3 Corey Welton 2012-09-17 15:36:50 UTC
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 15:37:35 UTC
Created attachment 613714 [details]
stack returned when performing this behavior

Comment 5 Ivan Necas 2012-09-18 10:01:37 UTC
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 13:08:03 UTC
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 06:12:21 UTC
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 20:03:08 UTC
QE Verified

CloudForms System Engine Version: 1.1.12-9.el6cf

Comment 11 David Davis 2012-10-09 21:23:54 UTC
*** Bug 859329 has been marked as a duplicate of this bug. ***

Comment 12 Mike McCune 2012-10-24 14:22:07 UTC
closing, currentrelease since these seemingly got missed in the 1.0.1 errata

Comment 13 Mike McCune 2013-08-16 17:57:18 UTC
getting rid of 6.0.0 version since that doesn't exist