Bug 1332297 - strip leading or trailing whitespaces on ip and user when adding a provider
Summary: strip leading or trailing whitespaces on ip and user when adding a provider
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.5.0
Hardware: All
OS: All
Target Milestone: GA
: 5.5.5
Assignee: Aparna Karve
QA Contact: Nandini Chandra
Depends On: 1318762
TreeView+ depends on / blocked
Reported: 2016-05-02 19:39 UTC by Chris Pelland
Modified: 2019-11-14 07:55 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
In the previous version of CloudForms, the user interface allowed a blank space to be accepted in the IP, FQDN, and user dialogs when adding a provider. This fix updates the detect_spaces directive, which has resolved the issue.
Clone Of: 1318762
Last Closed: 2016-07-26 15:33:22 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1488 normal SHIPPED_LIVE CFME 5.5.5 bug fixes and enhancement update 2016-07-26 19:28:27 UTC

Comment 1 CFME Bot 2016-06-27 16:47:33 UTC
New commit detected on cfme/5.5.z:

commit a8c1d56236ad17ca2b86939432c076c8d4d9d45a
Author:     Aparna Karve <akarve@redhat.com>
AuthorDate: Mon May 2 13:19:07 2016 -0700
Commit:     Aparna Karve <akarve@redhat.com>
CommitDate: Fri Jun 24 16:09:26 2016 -0700

    Use detect_spaces directive for ems_cloud

 app/assets/javascripts/directives/detect_spaces.js | 17 +++++++
 .../_auth_credentials_angular_bootstrap.html.haml  |  8 +++-
 .../views/ems_common/angular/_form.html.haml       | 54 +++++++++++++---------
 3 files changed, 56 insertions(+), 23 deletions(-)
 create mode 100644 app/assets/javascripts/directives/detect_spaces.js

Comment 2 CFME Bot 2016-06-27 16:47:38 UTC
New commit detected on cfme/5.5.z:

commit 07d2c38b2b3b80af68335ed5a812785933f67ac3
Merge: 1e34af1 7ad1a57
Author:     Dan Clarizio <dclarizi@redhat.com>
AuthorDate: Mon Jun 27 12:44:35 2016 -0400
Commit:     Dan Clarizio <dclarizi@redhat.com>
CommitDate: Mon Jun 27 12:44:35 2016 -0400

    Merge branch 'bz1332297_strip_spaces' into '5.5.z'
    Strip spaces in key form fields like hostname, port, userid
    1. For `ems_cloud`, we used a directive `detect_spaces` to block form submission in case if there are spaces detected in hostname, port, userid fields. This was possible because `ems_cloud` is an angular form in 5.5.z
    2. For non-angular forms like `ems_infra`, the `.strip` method was used to strip spaces.
    An upstream PR for the `detect_spaces` directive was created here -> https://github.com/ManageIQ/manageiq/pull/8398
    This is 100% manually created fix (no cherry-picks). The above PR was used as a reference for creating the directive and the spec.
    See merge request !992

 app/assets/javascripts/directives/detect_spaces.js | 17 +++++++
 app/controllers/ems_common.rb                      | 10 ++--
 .../_auth_credentials_angular_bootstrap.html.haml  |  8 +++-
 .../views/ems_common/angular/_form.html.haml       | 54 +++++++++++++---------
 spec/javascripts/directives/detect_spaces_spec.js  | 31 +++++++++++++
 spec/javascripts/support/jasmine.yml               |  1 +
 6 files changed, 93 insertions(+), 28 deletions(-)

Comment 4 Nandini Chandra 2016-06-30 08:54:59 UTC
It looks like the leading and trailing spaces still don't get stripped in the 'Name' field.

Comment 5 Aparna Karve 2016-06-30 17:13:53 UTC

The spaces are stripped only for fields like hostname, username ... since a space in those fields would make them invalid right away.

We do not strip spaces for the 'Name' field.


Comment 6 Nandini Chandra 2016-07-13 05:23:29 UTC
Verified in 5.5.5

Comment 8 errata-xmlrpc 2016-07-26 15:33:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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