diff --git a/gui/syncthing/core/validDeviceidDirective.js b/gui/syncthing/core/validDeviceidDirective.js index d3e0d9868..4f600cadc 100644 --- a/gui/syncthing/core/validDeviceidDirective.js +++ b/gui/syncthing/core/validDeviceidDirective.js @@ -15,6 +15,15 @@ angular.module('syncthing.core') ctrl.$setValidity('validDeviceid', true); } }); + //Prevents user from adding a duplicate ID + var matches = scope.devices.filter(function (n) { + return n.deviceID == viewValue; + }).length; + if (matches > 0) { + ctrl.$setValidity('unique', false); + } else { + ctrl.$setValidity('unique', true); + } } return viewValue; }); diff --git a/gui/syncthing/device/editDeviceModalView.html b/gui/syncthing/device/editDeviceModalView.html index c368c36fa..36260ba23 100644 --- a/gui/syncthing/device/editDeviceModalView.html +++ b/gui/syncthing/device/editDeviceModalView.html @@ -21,6 +21,7 @@ When adding a new device, keep in mind that this device must be added on the other side too. The device ID cannot be blank. The entered device ID does not look valid. It should be a 52 or 56 character string consisting of letters and numbers, with spaces and dashes being optional. + A device with that ID is already added.