RANGER-1311 : Ranger UI changes to support non-US characters in username 
related fields

Signed-off-by: Velmurugan Periasamy <v...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/823f51fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/823f51fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/823f51fe

Branch: refs/heads/master
Commit: 823f51fecd63c9d59690de225db224918a3d60d2
Parents: c19ec87
Author: Mehul Parikh <mehul.par...@freestoneinfotech.com>
Authored: Fri Jan 20 19:40:34 2017 +0530
Committer: Velmurugan Periasamy <v...@apache.org>
Committed: Fri Jan 20 20:25:38 2017 -0500

----------------------------------------------------------------------
 .../ranger/server/tomcat/EmbeddedServer.java    |   1 +
 .../org/apache/ranger/common/StringUtil.java    |   4 +-
 .../src/main/webapp/scripts/models/VXGroup.js   |   7 +-
 .../main/webapp/scripts/models/VXPortalUser.js  |  29 ++---
 .../main/webapp/scripts/modules/XAOverrides.js  | 107 ++++++++++++++++++-
 .../scripts/modules/globalize/message/en.js     |  32 +++---
 .../main/webapp/scripts/prelogin/XAPrelogin.js  |   2 +-
 .../src/main/webapp/scripts/utils/XAUtils.js    |  14 +++
 .../scripts/views/policies/PermissionList.js    |   3 +-
 .../scripts/views/user/UserProfileForm.js       |   4 +-
 .../webapp/scripts/views/users/GroupCreate.js   |   1 +
 .../webapp/scripts/views/users/UserCreate.js    |   3 +-
 .../main/webapp/scripts/views/users/UserForm.js |  61 ++++++-----
 .../scripts/views/users/UserTableLayout.js      |   4 +-
 security-admin/src/main/webapp/styles/xa.css    |  14 ++-
 15 files changed, 220 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
----------------------------------------------------------------------
diff --git 
a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
 
b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
index 7ebba8a..e334026 100644
--- 
a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
+++ 
b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
@@ -440,6 +440,7 @@ public class EmbeddedServer {
                
server.getConnector().setMaxPostSize(getIntConfig("ranger.service.http.connector.attrib.maxPostSize",
 2097152));
                
server.getConnector().setMaxSavePostSize(getIntConfig("ranger.service.http.connector.attrib.maxSavePostSize",
 4096));
                
server.getConnector().setParseBodyMethods(getConfig("ranger.service.http.connector.attrib.methods",
 "POST"));
+               
server.getConnector().setURIEncoding(getConfig("ranger.service.http.connector.attrib.URIEncoding",
 "UTF-8"));
                Iterator<Object> 
iterator=serverConfigProperties.keySet().iterator();
                String key=null;
                String property=null;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/java/org/apache/ranger/common/StringUtil.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/org/apache/ranger/common/StringUtil.java 
b/security-admin/src/main/java/org/apache/ranger/common/StringUtil.java
index a46858d..cd99588 100644
--- a/security-admin/src/main/java/org/apache/ranger/common/StringUtil.java
+++ b/security-admin/src/main/java/org/apache/ranger/common/StringUtil.java
@@ -34,9 +34,9 @@ public class StringUtil implements Serializable {
 
        static final public int MIN_PASSWORD_LENGTH = 8;
 
-       static final public String VALIDATION_NAME = "[\\w\\ \\-\\'\\.]*";
+       static final public String VALIDATION_NAME = 
"^([A-Za-z0-9]|[\u00C0-\u017F])([a-zA-Z0-9\\s_. -]|[\u00C0-\u017F])+$";
        static final public String VALIDATION_TEXT = "[a-zA-Z0-9\\ 
\"!@#$%^&amp;*()-_=+;:'&quot;|~`&lt;&gt;?/{}\\.\\,\\-\\?<>]*";
-       static final public String VALIDATION_LOGINID = 
"[a-z,A-Z][\\w\\-\\_]*[a-z,A-Z,0-9]";
+       static final public String VALIDATION_LOGINID = 
"^([A-Za-z0-9]|[\u00C0-\u017F])([a-z0-9,._\\-+/@= ]|[\u00C0-\u017F])+$";
 
        static final public String VALIDATION_ALPHA = "[a-z,A-Z]*";
        static final public String VALIDATION_IP_ADDRESS = "[\\d\\.\\%\\:]*";

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/models/VXGroup.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/models/VXGroup.js 
b/security-admin/src/main/webapp/scripts/models/VXGroup.js
index a399de2..d6725a1 100644
--- a/security-admin/src/main/webapp/scripts/models/VXGroup.js
+++ b/security-admin/src/main/webapp/scripts/models/VXGroup.js
@@ -67,10 +67,11 @@ define(function(require){
                        
                        return _.extend(attrs,{
                                name : {
-                                       type            : 'Text',
+                                       type            : 'TextFiledWithIcon',
                                        title           : 
localization.tt("lbl.groupName") +' *',
-                                       validators  : 
['required',{type:'regexp',regexp:/^[a-zA-Z][a-zA-Z0-9_'&-]*[A-Za-z0-9]$/i,message
 :'Name must start with alphabet and must end with alphabet or number and must 
have atleast two chars.Allowed special characters _ ,\' ,& ,-'}],
-                                        editorAttrs    :{ 'maxlength': 255},
+                                       validators  : 
['required',{type:'regexp',regexp:/^([A-Za-z0-9]|[\u00C0-\u017F])([a-z0-9,._\-+/@=
 ]|[\u00C0-\u017F])+$/i,message :' Invalid group name'}],
+                    editorAttrs : { 'maxlength': 255},
+                    errorMsg    : 
localization.tt('validationMessages.groupNameValidationMsg'),
                                },
                                description : {
                                        type            : 'TextArea',

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/models/VXPortalUser.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/models/VXPortalUser.js 
b/security-admin/src/main/webapp/scripts/models/VXPortalUser.js
index b031974..b0fe69f 100644
--- a/security-admin/src/main/webapp/scripts/models/VXPortalUser.js
+++ b/security-admin/src/main/webapp/scripts/models/VXPortalUser.js
@@ -47,17 +47,19 @@ define(function(require){
                        // Overwrite your schema definition here
                        return _.extend(attrs,{
                                firstName : {
-                                       type            : 'Text',
+                                       type            : 'TextFiledWithIcon',
                                        title           : 
localization.tt("lbl.firstName")+' *',
-                                       validators  : 
['required',{type:'regexp',regexp:/^[a-zA-Z][a-zA-Z0-9\s_.-]*[a-zA-Z0-9]+$/,message
 :'First name should start with alphabets & can have number,underscore, hyphen, 
space, dot.'}],
-                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.firstName")}
+                                       validators  : 
['required',{type:'regexp',regexp:/^([a-zA-Z0-9]|[\u00C0-\u017F])([a-zA-Z0-9\s_.
 -]|[\u00C0-\u017F])+$/i,message :'Invalid first name.'}],
+                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.firstName")},
+                                       errorMsg    
:localization.tt('validationMessages.firstNameValidationMsg'),
                                        
                                },
                                lastName : {
-                                       type            : 'Text',
+                                       type            : 'TextFiledWithIcon',
                                        title           : 
localization.tt("lbl.lastName"),
-                                       validators  : 
['required',{type:'regexp',regexp:/^[a-zA-Z][a-zA-Z0-9\s_.-]*[a-zA-Z0-9]+$/,message
 :'Last name should start with alphabets & can have number,underscore, hyphen, 
space, dot.'}],
-                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.lastName")}
+                                       validators  : 
['required',{type:'regexp',regexp:/^([a-zA-Z0-9]|[\u00C0-\u017F])([a-zA-Z0-9\s_.
 -]|[\u00C0-\u017F])+$/i,message :'Invalid last name.'}],
+                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.lastName")},
+                                       errorMsg    
:localization.tt('validationMessages.lastNameValidationMsg'),
                                },
                                emailAddress : {
                                        type            : 'Text',
@@ -67,27 +69,30 @@ define(function(require){
                                        
                                },
                                oldPassword : {
-                                       type            : 'Password',
+                                       type            : 'PasswordFiled',
                                        title           : 
localization.tt("lbl.oldPassword")+' *',
                                //      validators  : ['required'],
                                        fieldAttrs : {style : 'display:none;'},
-                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.oldPassword"),'oncopy':'return 
false;','autocomplete':'off'}
+                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.oldPassword"),'oncopy':'return 
false;','autocomplete':'off'},
+                                       errorMsg    : 
localization.tt('validationMessages.passwordError')
                                        
                                },
                                newPassword : {
-                                       type            : 'Password',
+                                       type            : 'PasswordFiled',
                                        title           : 
localization.tt("lbl.newPassword")+' *',
                                //      validators  : ['required'],
                                        fieldAttrs : {style : 'display:none;'},
-                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.newPassword"),'oncopy':'return 
false;','autocomplete':'off'}
+                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.newPassword"),'oncopy':'return 
false;','autocomplete':'off'},
+                                       errorMsg    : 
localization.tt('validationMessages.passwordError')
                                        
                                },
                                reEnterPassword : {
-                                       type            : 'Password',
+                                       type            : 'PasswordFiled',
                                        title           : 
localization.tt("lbl.reEnterPassword")+' *',
                                //      validators  : ['required'],
                                        fieldAttrs : {style : 'display:none;'},
-                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.reEnterPassword"),'oncopy':'return 
false;','autocomplete':'off'}
+                                       editorAttrs : { 'placeholder' : 
localization.tt("lbl.reEnterPassword"),'oncopy':'return 
false;','autocomplete':'off'},
+                                       errorMsg    : 
localization.tt('validationMessages.passwordError')
                                        
                                },
                                userRoleList : {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/modules/XAOverrides.js 
b/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
index b23318e..9774e3f 100644
--- a/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
+++ b/security-admin/src/main/webapp/scripts/modules/XAOverrides.js
@@ -22,6 +22,7 @@
        var App                         = require('App');
        var vBreadCrumbs        = require('views/common/BreadCrumbs');
        var XAEnums                     = require('utils/XAEnums');
+       var XAUtil                      = require('utils/XAUtils');
        
        require('backgrid');
        require('jquery-toggles');
@@ -283,7 +284,7 @@
           *
           */
          Form.editors.Switch = Form.editors.Base.extend({
-                       ui : {
+               ui : {
                                
                        },
                          events: {
@@ -353,7 +354,109 @@
                            this.$el.blur();
                          }
                        
-                       });
+               });
+         
+         //costume text filed
+         
+           Form.editors.TextFiledWithIcon = Form.editors.Base.extend({
+
+                     tagName: 'span',
+         
+                         defaultValue: '',
+         
+                         previousValue: '',
+         
+                         events: {
+                                 'keyup':    'determineChanges',
+                             'keypress': function(event) {
+                                 var self = this;
+                                 setTimeout(function() {
+                                         self.determineChanges();
+                                 }, 0);
+                             },
+                             'select [data-id="textFiledInput"]': "select",
+                             'focus [data-id="textFiledInput"]': "focus",
+                             'blur [data-id="textFiledInput"]':   "blur"
+                       
+                         },
+         
+                  
+                        
+                          
+                        initialize: function(options) {
+                                 
Form.editors.Base.prototype.initialize.call(this, options);
+                             this.template = _.template('<input type="text" 
class="textFiledInputPadding " data-id="textFiledInput"><span><i 
class="icon-info-sign customTextFiledIcon" 
data-id="infoTextFiled"></i></span>');
+                         var schema = this.schema;
+                               //Allow customising text type (email, phone 
etc.) for HTML5 browsers
+                                 var type = 'text';
+                         if (schema && schema.editorAttrs && 
schema.editorAttrs.type) type = schema.editorAttrs.type;
+                                 if (schema && schema.dataType) type = 
schema.dataType;
+                         this.$el.attr('type', type);
+                                 this.$el.html( this.template );
+                         },
+
+                        /**
+                        * Adds the editor to the DOM
+                    */
+                         render: function() {
+                                 if(this.schema.editorAttrs){
+                                         
this.$el.find('input').attr(this.schema.editorAttrs);
+                             }
+                                 this.setValue(this.value);
+                             
XAUtil.errorsInfoPopover(this.$el.find('[data-id="infoTextFiled"]'),this.schema.errorMsg);
+         
+                             return this;
+                          },
+                         determineChanges: function(event) {
+                            var currentValue = this.$el.find('input').val();
+                            var changed = (currentValue !== 
this.previousValue);
+                                if (changed) {
+                                this.previousValue = currentValue;
+                                    this.trigger('change', this);
+                             }
+                         },
+                         
+                          /**
+                          * Returns the current editor value
+                          * @return {String}
+                          */
+                         getValue: function() {
+                            return this.$el.find('input').val();
+                      },
+         
+                          /**
+                      * Sets the value of the form element
+                          * @param {String}
+                          */
+                         setValue: function(value) {
+                           this.$el.find('input').val(value);
+                          },
+                 focus: function() {
+                         if (this.hasFocus) return;
+              },
+                 blur: function() {
+                         var trimmedVal = $.trim(this.$el.find('input').val());
+                         this.$el.find('input').val(trimmedVal);
+                     },
+                 select: function() {
+                        this.$el.find('input').select();
+                          }
+         
+               });
+                
+                
+         /**
+           * Password editor
+               */
+         Form.editors.PasswordFiled = Form.editors.TextFiledWithIcon.extend({
+          initialize: function(options) {
+                       
Form.editors.TextFiledWithIcon.prototype.initialize.call(this, options);
+                       this.$el.find('input').attr('type', 'password');
+                           
+                   },
+
+               });
+         
          
          /**
           * #RANGER RESOURCE

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js 
b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
index 3d2612b..55024d1 100644
--- a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
+++ b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
@@ -404,27 +404,31 @@ define(function(require) {
                                
                        },      
                        validationMessages : {
-                               required                                        
: "* This field is required",
+                               required                           : "* This 
field is required",
                                onlyLetterNumberUnderscore :'* Only Alpha 
Numeric and underscore characters are allowed',
                                alphaNumericUnderscoreDotComma :'* Only Alpha 
Numeric,underscore,comma,hypen,dot and space characters are allowed',
-                               oldPasswordError :'Your password does not 
match. Please try again with proper password',
+                               oldPasswordError       :'Your password does not 
match. Please try again with proper password',
                                oldPasswordRepeatError :'You can not use old 
password.',
-                               newPasswordError :'Invalid Password.Minimum 8 
characters with min one alphabet and one numeric.',
-                               emailIdError                            : 
'Please enter valid email address.',
-                               enterValidName                          : 
'Please enter valid name.',
-                               passwordError               :'Invalid 
Password.Minimum 8 characters with min one alphabet and one numeric.'
+                               newPasswordError       :'Invalid Password. 
Minimum 8 characters with min one alphabet and one numeric.',
+                               emailIdError           : 'Please enter valid 
email address.',
+                               enterValidName         : 'Please enter valid 
name.',
+                               passwordError          :'Password should be 
minimum 8 characters with min one alphabet and one numeric.',
+                               userNameValidationMsg  :'1. User name should be 
start with alphabet/numeric/non-us characters.<br> 2. Allowed special character 
._\-+/@= and space. <br>3. Name length should be greater than one.',
+                               groupNameValidationMsg :'1. Group name should 
be start with alphabet/numeric/non-us characters.<br> 2. Allowed special 
character ._\-+/@= and space. <br>3. Name length should be greater than one.',
+                               firstNameValidationMsg :'1. First name should 
be start with alphabet/numeric/non-us characters.<br> 2. Allowed special 
character ._- and space. <br>3. Name length should be greater than one.',
+                               lastNameValidationMsg  :'1. Last name should be 
start with alphabet/numeric/non-us characters.<br> 2. Allowed special character 
._- and space. <br>3. Name length should be greater than one.',
                        },
                        serverMsg : {
                                
                                // UserMgr
-                               userMgrPassword : 'The password you\'ve 
provided is incorrect. Please try again with correct password',
-                               userMgrInvalidUser : 'Invalid user provided',
-                               userMgrNewPassword : 'Invalid new password',
-                               userMgrOldPassword : ' You can not use old 
password.',
-                               userMgrEmailChange : 'Email address cannot be 
changed. Please send a request to change using feedback',
-                               userMgrInvalidEmail : 'Invalid email address',
-                               userMgrWrongPassword : 'Password doesnot match. 
Please try again with proper password',
-                               userMgrWrongUser : 'User access denied. User 
not found.',
+                               userMgrPassword        : 'The password you\'ve 
provided is incorrect. Please try again with correct password',
+                               userMgrInvalidUser     : 'Invalid user 
provided',
+                               userMgrNewPassword     : 'Invalid new password',
+                               userMgrOldPassword     : ' You can not use old 
password.',
+                               userMgrEmailChange     : 'Email address cannot 
be changed. Please send a request to change using feedback',
+                               userMgrInvalidEmail    : 'Invalid email 
address',
+                               userMgrWrongPassword   : 'Password doesnot 
match. Please try again with proper password',
+                               userMgrWrongUser       : 'User access denied. 
User not found.',
                                fsDefaultNameValidationError:"Please provide  
fs.default.name in  format 'hdfs://hostname:portNumber' .",
                                fsDefaultNameEmptyError:'Please provide  
fs.default.name.',
                                userAlreadyExistsError : 'User already exists',

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/prelogin/XAPrelogin.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/prelogin/XAPrelogin.js 
b/security-admin/src/main/webapp/scripts/prelogin/XAPrelogin.js
index c6851c2..967094c 100644
--- a/security-admin/src/main/webapp/scripts/prelogin/XAPrelogin.js
+++ b/security-admin/src/main/webapp/scripts/prelogin/XAPrelogin.js
@@ -45,7 +45,7 @@ function doLogin() {
        }
 
        var regexEmail = 
/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-       var regexPlain = /^[a-z0-9][a-z0-9,._\-'+/@= ]+$/i;
+       var regexPlain = /^([A-Za-z0-9]|[\u00C0-\u017F])([a-z0-9,._\-+/@= 
]|[\u00C0-\u017F])+$/i;
        
        if(!regexPlain.test(userName)){
                if(!regexEmail.test(userName)){

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/utils/XAUtils.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js 
b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index ee401ee..c68c596 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -377,6 +377,20 @@ define(function(require) {
                }
        };
 
+       /*
+        * icon Info
+        */
+       XAUtils.errorsInfoPopover = function(filed, msg) {
+               filed.popover({
+                       content : '<span class="popoverTextMsg" 
>'+msg+'</span>',
+                       html    : true,
+                       trigger : 'hover',
+                       placement : 'right',
+                       container : 'body'
+
+                })
+       };
+       
        /**
         * Bootbox wrapper for alert
         * 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js 
b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
index b66b801..8b3582d 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
@@ -269,7 +269,7 @@ define(function(require) {
                                source: this.perms,
                                value : this.permsIds,
                                display: function(values,srcData) {
-                                       if(_.isNull(values) || 
_.isEmpty(values)){
+                                       if(_.isNull(values) || 
_.isEmpty(values) || (_.contains(values,"-1")  &&  values.length == 1)){
                                                $(this).empty();
                                                that.model.unset('accesses');
                                                
that.ui.addPermissionsSpan.find('i').attr('class', 'icon-plus');
@@ -278,6 +278,7 @@ define(function(require) {
                                        }
                                        if(_.contains(values,"-1")){
                                                values = _.without(values,"-1")
+
                                        }
 //                             that.checkDirtyFieldForGroup(values);
                                        

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/views/user/UserProfileForm.js
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/scripts/views/user/UserProfileForm.js 
b/security-admin/src/main/webapp/scripts/views/user/UserProfileForm.js
index 38ee737..a385592 100644
--- a/security-admin/src/main/webapp/scripts/views/user/UserProfileForm.js
+++ b/security-admin/src/main/webapp/scripts/views/user/UserProfileForm.js
@@ -103,9 +103,9 @@ define(function(require){
                                this.fields.newPassword.$el.show();
                                this.fields.reEnterPassword.$el.show();
                                this.fields.oldPassword.editor.validators = 
['required'];
-                               this.fields.newPassword.editor.validators = 
['required',{type : 'regexp' ,regexp 
:/^.*(?=.{8,256})(?=.*\d)(?=.*[a-zA-Z]).*$/, message : 
localization.tt('validationMessages.newPasswordError')}];
+                               this.fields.newPassword.editor.validators = 
['required',{type : 'regexp' ,regexp 
:/^.*(?=.{8,256})(?=.*\d)(?=.*[a-zA-Z]).*$/, message : ' Invalid password '}];
                                this.fields.reEnterPassword.editor.validators = 
['required',
-                                                                               
 {type : 'regexp' ,regexp :/^.*(?=.{8,256})(?=.*\d)(?=.*[a-zA-Z]).*$/, message 
: localization.tt('validationMessages.newPasswordError')},
+                                                                               
 {type : 'regexp' ,regexp :/^.*(?=.{8,256})(?=.*\d)(?=.*[a-zA-Z]).*$/, message 
: ' Invalid password '},
                                                                                
 { type: 'match', field: 'newPassword', message: 'Passwords must match!' }];
                        }
                },

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js 
b/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js
index 41678ab..a11dc47 100644
--- a/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/users/GroupCreate.js
@@ -84,6 +84,7 @@ define(function(require){
 
                /** on render callback */
                onRender: function() {
+                       var that = this
                        this.initializePlugins();
                        this.form = new GroupForm({
                                template : 
require('hbs!tmpl/users/GroupForm_tmpl'),

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/users/UserCreate.js 
b/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
index b0fc105..a0af92d 100644
--- a/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
@@ -100,7 +100,7 @@ define(function(require){
                        this.renderForm();
                        this.rForm.$el.dirtyFields();
                        
XAUtil.preventNavigation(localization.tt('dialogMsg.preventNavUserForm'),this.rForm.$el);
-               },
+                       },
                /** all post render plugin initialization */
                initializePlugins: function(){
                },
@@ -131,6 +131,7 @@ define(function(require){
                        this.form.fields.passwordConfirm.setValue('');
                },
                onSave: function(){
+                       var self= this;
                        var errors = this.form.commit({validate : false});
                        if(! _.isEmpty(errors)){
                                if(this.showBasicFields)

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/views/users/UserForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/users/UserForm.js 
b/security-admin/src/main/webapp/scripts/views/users/UserForm.js
index adf2f8b..9422c7e 100644
--- a/security-admin/src/main/webapp/scripts/views/users/UserForm.js
+++ b/security-admin/src/main/webapp/scripts/views/users/UserForm.js
@@ -32,12 +32,13 @@ define(function(require){
        
        require('backbone-forms');
        require('backbone-forms.templates');
+       require('bootbox');
        var UserForm = Backbone.Form.extend(
        /** @lends UserForm */
        {
                _viewName : 'UserForm',
-
-       /**
+         
+               /**
                * intialize a new UserForm Form View 
                * @constructs
                */
@@ -55,40 +56,49 @@ define(function(require){
                                //this.userRoleListChange(form, fieldEditor);
                });
                },
-               /** fields for the form
+               
+           /** fields for the form
                */
                fields: ['name', 'description'],
                schema :function(){
                        return{
                                name : {
-                                       type            : 'Text',
+                                       type            : 'TextFiledWithIcon',
                                        title           : 
localization.tt("lbl.userName") +' *',
-                                       validators  : 
['required',{type:'regexp',regexp:/^[a-z0-9][a-z0-9,._\-'+/@= ]+$/i,message 
:"Name should start with alpha/numeric letters and can have special characters 
,.+_'-/@= and space"}],
-                                       editorAttrs :{'maxlength': 255}
+                                       validators  : 
['required',{type:'regexp',regexp:/^([A-Za-z0-9]|[\u00C0-\u017F])([a-z0-9,._\-+/@=
 ]|[\u00C0-\u017F])+$/i, 
+                                                           message :' Invalid 
user name'}],
+                                       editorAttrs : {'maxlength': 255},
+                               errorMsg    
:localization.tt('validationMessages.userNameValidationMsg')
                                },
                                password : {
-                                       type            : 'Password',
+                                       type            : 'PasswordFiled',
                                        title           : 
localization.tt("lbl.newPassword") +' *',
-                                       validators  : ['required', {type: 
'match', field: 'passwordConfirm', message: 'Passwords must match!'},
-                                                      
{type:'regexp',regexp:/^.*(?=.{8,256})(?=.*\d)(?=.*[a-zA-Z]).*$/,message 
:localization.tt('validationMessages.passwordError')}],
-                                       editorAttrs  : {'oncopy':'return 
false;','autocomplete':'off'}               
+                                       validators  : ['required',
+                                                      
{type:'regexp',regexp:/^.*(?=.{8,256})(?=.*\d)(?=.*[a-zA-Z]).*$/,message :' 
Invalid password'}],
+                                       editorAttrs : {'oncopy':'return 
false;','autocomplete':'off'},
+                                       errorMsg    : 
localization.tt('validationMessages.passwordError')
                                },
                                passwordConfirm : {
-                                       type            : 'Password',
+                                       type            : 'PasswordFiled',
                                        title           : 
localization.tt("lbl.passwordConfirm") +' *',
-                                       validators  : ['required',
-                                                      
{type:'regexp',regexp:/^.*(?=.{8,256})(?=.*\d)(?=.*[a-zA-Z]).*$/,message 
:localization.tt('validationMessages.passwordError')}],
-                                       editorAttrs  : {'oncopy':'return 
false;','autocomplete':'off'}
+                                       validators  : ['required',{type: 
'match', field: 'password', message: 'Passwords must match !'},
+                                                      
{type:'regexp',regexp:/^.*(?=.{8,256})(?=.*\d)(?=.*[a-zA-Z]).*$/,message :' 
Invalid password'}],
+                                       editorAttrs : {'oncopy':'return 
false;','autocomplete':'off'},
+                                       errorMsg    : 
localization.tt('validationMessages.passwordError')
                                },
                                firstName : { 
-                                       type            : 'Text',
+                                       type            : 'TextFiledWithIcon',
                                        title           : 
localization.tt("lbl.firstName")+' *',
-                                       validators  : 
['required',{type:'regexp',regexp:/^[a-zA-Z][a-zA-Z0-9\s_.-]*[a-zA-Z0-9]+$/,message
 :'First name should start with alphabets & can have number,underscore, hyphen, 
space, dot.'}]
+                                       validators  : 
['required',{type:'regexp',regexp:/^([A-Za-z0-9]|[\u00C0-\u017F])([a-zA-Z0-9\s_.
 -]|[\u00C0-\u017F])+$/i, 
+                                                           message :' Invalid 
first name'}],
+                                       errorMsg    
:localization.tt('validationMessages.firstNameValidationMsg'),
                                },
                                lastName : { 
-                                       type            : 'Text',
+                                       type            : 'TextFiledWithIcon',
                                        title           : 
localization.tt("lbl.lastName"),
-                                       validators  : 
[{type:'regexp',regexp:/^[a-zA-Z][a-zA-Z0-9\s_.-]*[a-zA-Z0-9]+$/,message :'Last 
name should start with alphabets & can have number,underscore, hyphen, space, 
dot.'}]
+                                       validators  : 
[{type:'regexp',regexp:/^([A-Za-z0-9]|[\u00C0-\u017F])([a-zA-Z0-9\s_. 
-]|[\u00C0-\u017F])+$/i, 
+                                                           message :' Invalid 
last name'}],
+                                       errorMsg    
:localization.tt('validationMessages.lastNameValidationMsg'),
                                },
                                emailAddress : {
                                        type            : 'Text',
@@ -108,6 +118,7 @@ define(function(require){
                                                });
                                                var nvPairs = 
XAUtils.enumToSelectPairs(userTypes);
                                                callback(nvPairs);
+                                               editor.$el.val("0");
                                        },
                                        title : 
localization.tt('lbl.selectRole')+' *'
                                }
@@ -121,7 +132,7 @@ define(function(require){
                        this.initializePlugins();
                        this.showCustomFields();
                        if(!that.model.isNew()){
-                               
this.fields.name.editor.$el.attr('disabled',true);
+                               
this.fields.name.editor.$el.find('input').attr('disabled',true);
                                if(this.model.has('userRoleList')){
                                        var roleList = 
this.model.get('userRoleList');
                                        if(!_.isUndefined(roleList) && 
roleList.length > 0){
@@ -135,13 +146,13 @@ define(function(require){
                                        }
                                }
                                if(!_.isUndefined(this.model.get('userSource')) 
&& this.model.get('userSource') == XAEnums.UserSource.XA_USER.value){
-                                       
this.fields.password.editor.$el.attr('disabled',true);
-                                       
this.fields.passwordConfirm.editor.$el.attr('disabled',true);
-                                       
this.fields.firstName.editor.$el.attr('disabled',true);
-                                       
this.fields.lastName.editor.$el.attr('disabled',true);
+                                       
this.fields.password.editor.$el.find('input').attr('disabled',true);
+                                       
this.fields.passwordConfirm.editor.$el.find('input').attr('disabled',true);
+                                       
this.fields.firstName.editor.$el.find('input').attr('disabled',true);
+                                       
this.fields.lastName.editor.$el.find('input').attr('disabled',true);
                                        
this.fields.emailAddress.editor.$el.attr('disabled',true);
                                        
this.fields.userRoleList.editor.$el.attr('disabled',true);
-                                       
+                                       return
                                }
                                
                                if(SessionMgr.getUserProfile().get('loginId') 
!= "admin"){
@@ -164,7 +175,7 @@ define(function(require){
                                if(this.model.get('name') == 
SessionMgr.getUserProfile().get('loginId')){
                                        
this.fields.userRoleList.editor.$el.attr('disabled',true);
                                }
-                       }                       
+                       }       
                },
                renderCustomFields: function(){
                        var that = this;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js 
b/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
index 5b6faa7..da39d39 100644
--- a/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/users/UserTableLayout.js
@@ -456,8 +456,8 @@ define(function(require){
                        var selArr = [];
                        var message = '';
                        _.each(collection.selected,function(obj){
-                               selArr.push(_.escape(obj.get('name')));
-                       });
+                                selArr.push(_.escape(obj.get('name')));
+            });
                        var  vXStrings = [];
                        var jsonUsers  = {};
                        for(var i in selArr) {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/823f51fe/security-admin/src/main/webapp/styles/xa.css
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/styles/xa.css 
b/security-admin/src/main/webapp/styles/xa.css
index e2abab9..84a04d8 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -2088,7 +2088,19 @@ td.subgrid-custom-cell{
 .selected-widget .remove{
     cursor:pointer;
 }
-.uploadSet {
+.customTextFiledIcon{
+       color: #808080;
+    font-size: small;
+    margin-left: -17px;
+    margin-right:5px;
+}
+.textFiledInputPadding{
+       padding-right: 20px !important;
+    width: 192px !important;
+}
+.popoverTextMsg{
+       font-size:11px;
+}.uploadSet {
        margin-top: 20px;
 }
 .margin-left130{

Reply via email to