AMBARI-18421. Link Creation of user with special character passes but on 
loading user page, there is a warning message displayed. (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: b4f3809e4c32e9c9aa8a6700608413fc89a23c63
Parents: 468764e
Author: Alex Antonenko <hiv...@gmail.com>
Authored: Mon Sep 19 21:25:54 2016 +0300
Committer: Alex Antonenko <hiv...@gmail.com>
Committed: Mon Sep 19 21:26:08 2016 +0300

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/b4f3809e/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 0aefaba..bc16f0e 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
@@ -336,6 +336,8 @@ angular.module('ambariAdminConsole')
       'showAll': 'Show all users',
       'showAdmin': 'Show only admin users',
       'groupMembership': 'Group Membership',
+      'userNameTip': 'Only alpha-numeric characters, up to 80 characters',
+
 
       'changeStatusConfirmation': {
         'title': 'Change Status',

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4f3809e/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..cc5d8d4 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
@@ -23,8 +23,22 @@
 <form class="form-horizontal create-user-form" role="form" novalidate 
name="form" autocomplete="off">
   <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">
+    <div class="col-sm-10"
+         ng-class="{'has-error': form.user_name.$error.pattern}">
+      <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="/^\w*$/"
+        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>

Reply via email to