diff --git a/frontend-js/src/main/js/gui/admin/EditUserDialog.js b/frontend-js/src/main/js/gui/admin/EditUserDialog.js index 53d9f99470d43eda50e8e99b233d2ff359ae4bd3..298c2e9dae46bc3a0bde457daa7108b76127d01d 100644 --- a/frontend-js/src/main/js/gui/admin/EditUserDialog.js +++ b/frontend-js/src/main/js/gui/admin/EditUserDialog.js @@ -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; diff --git a/frontend-js/src/test/js/gui/admin/EditUserDialog-test.js b/frontend-js/src/test/js/gui/admin/EditUserDialog-test.js index 460ba24bb315c619f1c01eb38a0e1f2f03f86f10..fffbc379b3ca5fb7150114c9b6bf6f9d59f24672 100644 --- a/frontend-js/src/test/js/gui/admin/EditUserDialog-test.js +++ b/frontend-js/src/test/js/gui/admin/EditUserDialog-test.js @@ -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({});