Commit 8b676577 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

new user must have not empty password defined

parent f91cce0c
......@@ -670,6 +670,11 @@ EditUserDialog.prototype.checkValidity = function () {
error += "<li>Password doesn't match</li>";
isValid = false;
}
if (self.getIsNewUser() && self.getPassword() === "") {
error += "<li>Password for the user is not defined</li>";
isValid = false;
}
if (self.getLogin() === "" || self.getLogin() === undefined) {
error += "<li>Login must not be empty</li>";
isValid = false;
......
......@@ -60,6 +60,22 @@ describe('EditUserDialog', function () {
});
});
it('new user without password', function () {
var user = new User({});
var dialog = createEditUserDialog(user);
return dialog.init().then(function () {
dialog.setLogin("x");
return dialog.checkValidity().then(function () {
assert.ok(null);
}, function (error) {
assert.ok(error instanceof ValidationError);
});
}).then(function () {
dialog.destroy();
});
});
it('too long user login', function () {
var dialog;
var user = new User({});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment