diff --git a/frontend-js/src/main/js/gui/admin/EditUserDialog.js b/frontend-js/src/main/js/gui/admin/EditUserDialog.js
index fad069c7d2d1475056ab68ed8b92e93d3a3185d5..53d9f99470d43eda50e8e99b233d2ff359ae4bd3 100644
--- a/frontend-js/src/main/js/gui/admin/EditUserDialog.js
+++ b/frontend-js/src/main/js/gui/admin/EditUserDialog.js
@@ -674,6 +674,10 @@ EditUserDialog.prototype.checkValidity = function () {
     error += "<li>Login must not be empty</li>";
     isValid = false;
   }
+  if (self.getLogin().length > 255) {
+    error += "<li>Login must shorter than 256 characters</li>";
+    isValid = false;
+  }
   if (isValid) {
     return Promise.resolve(true);
   } else {
@@ -708,6 +712,10 @@ EditUserDialog.prototype.getLogin = function () {
   return $("[name='userLogin']", self.getElement()).val();
 };
 
+EditUserDialog.prototype.setLogin = function (login) {
+  $("[name='userLogin']", this.getElement()).val(login);
+};
+
 /**
  *
  * @returns {string}
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 d6eeb71c49494849b3aceb1db69566e5fdb160ed..8d829334512c2ff23debd5bcfc8ef08e7718f260 100644
--- a/frontend-js/src/test/js/gui/admin/EditUserDialog-test.js
+++ b/frontend-js/src/test/js/gui/admin/EditUserDialog-test.js
@@ -15,10 +15,14 @@ var chai = require('chai');
 var assert = chai.assert;
 var expect = chai.expect;
 
-function createEditUserDialog(project, user) {
+/**
+ *
+ * @param {User} user
+ * @return {EditUserDialog}
+ */
+function createEditUserDialog(user) {
   return new EditUserDialog({
     element: testDiv,
-    project: project,
     user: user,
     configuration: helper.getConfiguration(),
     serverConnector: ServerConnector
@@ -33,8 +37,7 @@ describe('EditUserDialog', function () {
       var project;
       var user = new User({});
       return ServerConnector.getProject().then(function (result) {
-        project = result;
-        dialog = createEditUserDialog(project, user);
+        dialog = createEditUserDialog(user);
         return dialog.init();
       }).then(function () {
         assert.equal(0, logger.getWarnings().length);
@@ -48,11 +51,9 @@ describe('EditUserDialog', function () {
   describe('checkValidity', function () {
     it('empty user', function () {
       var dialog;
-      var project;
       var user = new User({});
       return ServerConnector.getProject().then(function (result) {
-        project = result;
-        dialog = createEditUserDialog(project, user);
+        dialog = createEditUserDialog(user);
         return dialog.init();
       }).then(function () {
         return dialog.checkValidity().then(function () {
@@ -65,16 +66,30 @@ describe('EditUserDialog', function () {
       });
     });
 
+    it('too long user login', function () {
+      var dialog;
+      var user = new User({});
+      dialog = createEditUserDialog(user);
+      return dialog.init().then(function () {
+        dialog.setLogin("x".repeat(256));
+        return dialog.checkValidity().then(function () {
+          assert.ok(null);
+        }).catch(function (error) {
+          assert.ok(error instanceof ValidationError);
+        });
+      }).then(function () {
+        dialog.destroy();
+      });
+    });
+
     it('existing user', function () {
       var dialog;
-      var project;
       var user;
       return ServerConnector.getUser("anonymous").then(function (result) {
         user = result;
         return ServerConnector.getProject();
       }).then(function (result) {
-        project = result;
-        dialog = createEditUserDialog(project, user);
+        dialog = createEditUserDialog(user);
         return dialog.init();
       }).then(function () {
         return dialog.checkValidity();
@@ -90,14 +105,12 @@ describe('EditUserDialog', function () {
     it('existing user', function () {
       helper.loginAsAdmin();
       var dialog;
-      var project;
       var user;
       return ServerConnector.getUser("admin").then(function (result) {
         user = result;
         return ServerConnector.getProject();
       }).then(function (result) {
-        project = result;
-        dialog = createEditUserDialog(project, user);
+        dialog = createEditUserDialog(user);
         return dialog.init();
       }).then(function () {
         return dialog.onSaveClicked();
@@ -111,7 +124,6 @@ describe('EditUserDialog', function () {
     it('existing user', function () {
       helper.loginAsAdmin();
       var dialog;
-      var project;
       var user;
       var serializedPrivileges;
       return ServerConnector.getUser("anonymous").then(function (result) {
@@ -119,8 +131,7 @@ describe('EditUserDialog', function () {
         serializedPrivileges = user.getPrivileges().slice();
         return ServerConnector.getProject();
       }).then(function (result) {
-        project = result;
-        dialog = createEditUserDialog(project, user);
+        dialog = createEditUserDialog(user);
         return dialog.init();
       }).then(function () {
         var checkbox = $("[name=privilege-checkbox]", dialog.getElement())[0];