Browse Source

AMBARI-1339. Validate usernames in Misc section of Customize Services step in Install Wizard. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1442297 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 năm trước cách đây
mục cha
commit
cfd440f564

+ 3 - 0
CHANGES.txt

@@ -38,6 +38,9 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1339. Validate usernames in Misc section of Customize Services step
+ in Install Wizard. (yusaku)
+
  AMBARI-1335. Show validation error when the user specifies target hosts that are
  already part of the cluster. (yusaku)
 

+ 2 - 2
ambari-web/app/controllers/wizard/step7_controller.js

@@ -290,7 +290,7 @@ App.WizardStep7Controller = Em.Controller.extend({
 
   /**
    * Set display names of the property tfrom he puppet/global names
-   * @param: displayNames: a field to be set with displayNames
+   * @param displayNames: a field to be set with displayNames
    * @param names: array of property puppet/global names
    * @param configProperties: array of config properties of the respective service to the name param
    */
@@ -304,7 +304,7 @@ App.WizardStep7Controller = Em.Controller.extend({
 
   /**
    * Display Error Message with service name, its custom configuration name and displaynames on the page
-   * @param: customConfig: array with custom configuration, serviceName and displayNames relative to custom configuration
+   * @param customConfig: array with custom configuration, serviceName and displayNames relative to custom configuration
    */
   showCustomConfigErrMsg: function (customConfig) {
 

+ 1 - 1
ambari-web/app/data/config_properties.js

@@ -647,7 +647,7 @@ module.exports =
       "description": "",
       "defaultValue": "users",
       "isReconfigurable": false,
-      "displayType": "advanced",
+      "displayType": "user",
       "isVisible": true,
       "filename": "core-site.xml",
       "domain": "global",

+ 2 - 1
ambari-web/app/messages.js

@@ -34,6 +34,8 @@ Em.I18n.translations = {
   'graphs.error.title': 'Error',
   'graphs.error.message': 'There was a problem getting data for the chart ({0}: {1})',
 
+  'users.userName.validationFail': 'Value should contains only letters and digits and start with letter',
+
   'services.nagios.description':'Nagios Monitoring and Alerting system',
   'services.ganglia.description':'Ganglia Metrics Collection system',
   'services.hdfs.description':'Apache Hadoop Distributed File System',
@@ -252,7 +254,6 @@ Em.I18n.translations = {
   'admin.users.username':'Username',
   'admin.users.createSuccess': 'User successfully created.',
   'admin.users.createError': 'Error occurred while user creating.',
-  'admin.users.createError.userNameValidation': 'User name should contains only letters and digits and start with letter',
   'admin.users.createError.passwordValidation': 'Passwords are different',
   'admin.users.createError.userNameExists': 'User with the same name is already exists',
   'admin.users.editError.requiredField': 'This is required',

+ 6 - 0
ambari-web/app/models/service_config.js

@@ -376,6 +376,12 @@ App.ServiceConfigProperty = Ember.Object.extend({
           break;
         case 'custom':
           break;
+        case 'user':
+          if (!validator.isValidUserName(value)) {
+            this.set('errorMessage', Em.I18n.t('users.userName.validationFail'));
+          }
+          isError = true;
+          break;
         case 'email':
           if (!validator.isValidEmail(value)) {
             this.set('errorMessage', 'Must be a valid email address');

+ 1 - 1
ambari-web/app/models/user.js

@@ -133,7 +133,7 @@ App.CreateUserForm = App.Form.extend({
       var userName = userNameField.get('value');
 
       if (!validator.isValidUserName(userName)) {
-        userNameField.set('errorMessage', this.t('admin.users.createError.userNameValidation'));
+        userNameField.set('errorMessage', this.t('users.userName.validationFail'));
         isValid = false;
       }