From 02f10524405e317a06eabe5d96d2867b4264243c Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 16 Feb 2019 12:48:16 +0000 Subject: [PATCH 1/2] Amended wifi password UI to show "****". Only store passwords which are not equal to "****". Removes previous behaviour where wifi password with an asterisk was ignored. --- sonoff/i18n.h | 1 + sonoff/xdrv_01_webserver.ino | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sonoff/i18n.h b/sonoff/i18n.h index fa921afed..f910ba015 100644 --- a/sonoff/i18n.h +++ b/sonoff/i18n.h @@ -419,6 +419,7 @@ /********************************************************************************************/ #define D_ASTERIX "********" +#define D_ASTERISK_PWD "****" #ifndef MY_LANGUAGE #include "language/en-GB.h" diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index ab16ae8fd..87165586b 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -280,9 +280,9 @@ const char HTTP_FORM_WIFI[] PROGMEM = "
 " D_WIFI_PARAMETERS " " "
" "

" D_AP1_SSID " (" STA_SSID1 ")

" - "

" D_AP1_PASSWORD "

" + "

" D_AP1_PASSWORD "

" "

" D_AP2_SSID " (" STA_SSID2 ")

" - "

" D_AP2_PASSWORD "

" + "

" D_AP2_PASSWORD "

" "

" D_HOSTNAME " (" WIFI_HOSTNAME ")

"; const char HTTP_FORM_LOG1[] PROGMEM = @@ -1082,9 +1082,9 @@ void WifiSaveSettings(void) WebGetArg("s2", tmp, sizeof(tmp)); strlcpy(Settings.sta_ssid[1], (!strlen(tmp)) ? STA_SSID2 : tmp, sizeof(Settings.sta_ssid[1])); WebGetArg("p1", tmp, sizeof(tmp)); - strlcpy(Settings.sta_pwd[0], (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? Settings.sta_pwd[0] : tmp, sizeof(Settings.sta_pwd[0])); + strlcpy(Settings.sta_pwd[0], (!strlen(tmp)) ? "" : (!strcmp(tmp,D_ASTERISK_PWD)) ? Settings.sta_pwd[0] : tmp, sizeof(Settings.sta_pwd[0])); WebGetArg("p2", tmp, sizeof(tmp)); - strlcpy(Settings.sta_pwd[1], (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? Settings.sta_pwd[1] : tmp, sizeof(Settings.sta_pwd[1])); + strlcpy(Settings.sta_pwd[1], (!strlen(tmp)) ? "" : (!strcmp(tmp,D_ASTERISK_PWD)) ? Settings.sta_pwd[1] : tmp, sizeof(Settings.sta_pwd[1])); snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_CMND_HOSTNAME " %s, " D_CMND_SSID "1 %s, " D_CMND_SSID "2 %s"), Settings.hostname, Settings.sta_ssid[0], Settings.sta_ssid[1]); AddLog(LOG_LEVEL_INFO); From e6029e18bea9b988aaa70924f0114c3356b13915 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 16 Feb 2019 12:51:43 +0000 Subject: [PATCH 2/2] Fix typos. --- sonoff/xdrv_01_webserver.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 87165586b..87116d8f6 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -280,9 +280,9 @@ const char HTTP_FORM_WIFI[] PROGMEM = "
 " D_WIFI_PARAMETERS " " "" "

" D_AP1_SSID " (" STA_SSID1 ")

" - "

" D_AP1_PASSWORD "

" + "

" D_AP1_PASSWORD "

" "

" D_AP2_SSID " (" STA_SSID2 ")

" - "

" D_AP2_PASSWORD "

" + "

" D_AP2_PASSWORD "

" "

" D_HOSTNAME " (" WIFI_HOSTNAME ")

"; const char HTTP_FORM_LOG1[] PROGMEM =