1
0
Fork 0

Bug fix/issue 3228 devel - fixed wrong validation of name user property (#3391)

* UI - added user roles

* some code changes, added missing picture

* fixed issue #3228
This commit is contained in:
Heiko 2017-10-13 12:22:35 +02:00 committed by Frank Celler
parent bb1d303473
commit 41b9f1e146
2 changed files with 2 additions and 32 deletions

View File

@ -1,6 +1,8 @@
devel
-----
* UI: fixed wrong user attribute name validation, issue #3228
* make AQL return a proper error message in case of a unique key constraint
violation. previously it only returned the generic "unique constraint violated"
error message but omitted the details about which index caused the problem.

View File

@ -270,39 +270,11 @@
}
},
validateUsername: function (username) {
if (username === '') {
arangoHelper.arangoError('You have to define an username');
$('#newUsername').closest('th').css('backgroundColor', 'red');
return false;
}
if (!username.match(/^[a-zA-Z][a-zA-Z0-9_-]*$/)) {
arangoHelper.arangoError(
'Wrong Username', 'Username may only contain numbers, letters, _ and -'
);
return false;
}
return true;
},
editUserPassword: function () {
window.modalView.hide();
this.createEditUserPasswordModal();
},
validateName: function (name) {
if (name === '') {
return true;
}
if (!name.match(/^[a-zA-Z][a-zA-Z0-9_-]*$/)) {
arangoHelper.arangoError(
'Wrong Username', 'Username may only contain numbers, letters, _ and -'
);
return false;
}
return true;
},
submitEditUser: function (username) {
var name = $('#editName').val();
var status = $('#editStatus').is(':checked');
@ -311,10 +283,6 @@
$('#editStatus').closest('th').css('backgroundColor', 'red');
return;
}
if (!this.validateName(name)) {
$('#editName').closest('th').css('backgroundColor', 'red');
return;
}
var user = this.collection.findWhere({'user': username});
user.save({'extra': {'name': name}, 'active': status}, {
type: 'PATCH',