rel_chpwd_btn: 'chpwd_btn'
}
},
+ validators: {
+ user_pattern: null
+ },
init: function() {
this.setEvents();
},
document.getElementById(this.ids.create_user.newuser).addEventListener('keydown', function(e) {
var target = e.target || e.srcElement;
if (e.keyCode == 13) {
- $(target.nextElementSibling).click();
+ $(target.parentNode.getElementsByTagName('A')[0]).click();
} else if (e.keyCode == 27) {
this.cancelAddUser();
}
},
userValidator: function(user) {
user = user.replace(/\s/g, '');
- var valid = user != '';
- return valid;
+ if (user == '') {
+ alert(this.txt.enter_login);
+ return false;
+ }
+ var valid = this.validators.user_pattern.test(user);
+ if (valid === false) {
+ alert(this.txt.invalid_login);
+ return false;
+ }
+ return true;
},
pwdValidator: function(pwd) {
var valid = pwd.length > 4;
+ if (valid === false) {
+ alert(this.txt.invalid_pwd);
+ }
return valid;
},
addUser: function() {
- var valid = true;
var user = document.getElementById(this.ids.create_user.newuser).value;
var pwd = document.getElementById(this.ids.create_user.newpwd).value;
if (this.userValidator(user) === false) {
- alert(this.txt.enter_login);
- valid = false;
+ return false;
}
if (this.pwdValidator(pwd) === false) {
- alert(this.txt.invalid_pwd);
- valid = false;
- }
- if (valid === true) {
- $(this.ids.create_user.add_user).hide();
- this.action_callback('newuser', user, pwd);
+ return false;
}
- return valid;
+
+ $(this.ids.create_user.add_user).hide();
+ this.action_callback('newuser', user, pwd);
+ return true;
},
rmUser: function(user) {
this.action_callback('rmuser', user);
$(el.nextElementSibling).select('input')[0].focus();
},
changePwd: function(el, user) {
- var valid = true;
var pwd = el.value;
if (this.pwdValidator(pwd) === false) {
- alert(this.txt.invalid_pwd);
- valid = false;
- }
- if (valid === true) {
- $(el.parentNode).hide();
- $(el.parentNode.previousElementSibling).show();
- this.action_callback('chpwd', user, pwd);
+ return false;
}
+
+ $(el.parentNode).hide();
+ $(el.parentNode.previousElementSibling).show();
+ this.action_callback('chpwd', user, pwd);
+ return true;
},
cancelAddUser: function() {
$(this.ids.create_user.add_user).hide();
public $windowIds = array('Storage', 'Client', 'Volume', 'Pool', 'Job', 'JobRun');
+ public $userPattern;
+
public function onPreInit($param) {
parent::onPreInit($param);
if (!$this->IsPostBack && !$this->IsCallBack) {
$this->goToPage('ConfigurationWizard');
}
+ $this->userPattern = $this->getModule('configuration')->getUserPattern();
$appConfig = $this->getModule('configuration')->getApplicationConfig();
$this->Users->Visible = $this->User->getIsAdmin();