EmonESP icon indicating copy to clipboard operation
EmonESP copied to clipboard

HTTP password input field should not allow longer than 16 characters

Open glynhudson opened this issue 5 years ago • 1 comments

Password is currently limited to 16 characters but it is possible for a user to enter a longer password which results in silent failure then user is unable to login since password in truncated.This could be fixed by a hard limit on the password input field.

https://community.openenergymonitor.org/t/reset-http-auth-password-on-esp8266/11159

glynhudson avatar Jun 12 '19 15:06 glynhudson

Fixed this in config.js under the admin save event:

self.saveAdminFetching = ko.observable(false);
self.saveAdminSuccess = ko.observable(false);
self.saveAdmin = function () {
	var adminsave = {
		user: self.config.www_username(),
		pass: self.config.www_password()
	};
	
	if (adminsave.user.length > 16 || adminsave.pass.length > 16) {
		alert("Please enter a username and password that is 16 characters or less");
	} else {
  self.saveAdminFetching(true);
  self.saveAdminSuccess(false);
  $.post(baseEndpoint + "/saveadmin", adminsave, function (data) {
    self.saveAdminSuccess(true);
  }).fail(function () {
    alert("Failed to save Admin config");
  }).always(function () {
    self.saveAdminFetching(false);
  });
 }
};

CircuitSetup avatar Jul 25 '19 17:07 CircuitSetup