You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2017/04/26 14:13:59 UTC

ambari git commit: AMBARI-20772. FE: Characters used in usernames should be constrained (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 217cad97a -> 8ce04c679


AMBARI-20772. FE: Characters used in usernames should be constrained (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8ce04c67
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8ce04c67
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8ce04c67

Branch: refs/heads/branch-2.5
Commit: 8ce04c679f6aa1f2585b6a985919182f98db67de
Parents: 217cad9
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Apr 25 20:59:50 2017 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Apr 26 17:13:55 2017 +0300

----------------------------------------------------------------------
 .../ui/admin-web/app/scripts/i18n.config.js          |  1 +
 .../ui/admin-web/app/views/users/create.html         | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ce04c67/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index 3bb33e3..f7f2d0c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -334,6 +334,7 @@ angular.module('ambariAdminConsole')
       'showAll': 'Show all users',
       'showAdmin': 'Show only admin users',
       'groupMembership': 'Group Membership',
+      'userNameTip': 'Maximum length is 80 characters. \\, &, |, <, >, ` are not allowed.',
 
       'changeStatusConfirmation': {
         'title': 'Change Status',

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ce04c67/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html
index bc86819..e7035d3 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/create.html
@@ -24,7 +24,20 @@
   <div class="form-group" ng-class="{'has-error' : form.user_name.$error.required && form.submitted}">
     <label for="username" class="col-sm-2 control-label">{{'users.username' | translate}}</label>
     <div class="col-sm-10">
-      <input type="text" id="username" class="form-control username-input" name="user_name" placeholder="{{'users.userName' | translate}}" ng-model="user.user_name" required autocomplete="off">
+      <input
+          autofocus
+          type="text"
+          id="username"
+          class="form-control username-input"
+          name="user_name"
+          placeholder="{{'users.userName' | translate}}"
+          ng-model="user.user_name"
+          ng-required="true"
+          ng-pattern="/^[^<>&`|\\]+$/"
+          ng-maxlength="80"
+          tooltip="{{'users.userNameTip' | translate}}"
+          autocomplete="off"
+          tooltip-trigger="focus">
       <div class="alert alert-danger top-margin" ng-show="form.user_name.$error.required && form.submitted">{{'common.alerts.fieldIsRequired' | translate}}</div>
     </div>
   </div>