@@ -81,7 +81,7 @@ HttpdBuiltInUrl builtInUrls[] = {
81
81
{ "/console/text" , ajaxConsole , NULL },
82
82
{ "/console/send" , ajaxConsoleSend , NULL },
83
83
//Enable the line below to protect the WiFi configuration with an username/password combo.
84
- // {"/wifi/*", authBasic, myPassFn},
84
+ {"/wifi/*" , authBasic , myPassFn },
85
85
{ "/wifi" , cgiRedirect , "/wifi/wifi.html" },
86
86
{ "/wifi/" , cgiRedirect , "/wifi/wifi.html" },
87
87
{ "/wifi/info" , cgiWifiInfo , NULL },
@@ -217,3 +217,21 @@ user_init(void) {
217
217
system_show_malloc ();
218
218
#endif
219
219
}
220
+
221
+ //Function that tells the authentication system what users/passwords live on the system.
222
+ //This is disabled in the default build; if you want to try it, enable the authBasic line in
223
+ //the builtInUrls below.
224
+ int myPassFn (HttpdConnData * connData , int no , char * user , int userLen , char * pass , int passLen ) {
225
+ if (no == 0 ) {
226
+ os_strcpy (user , "admin" );
227
+ os_strcpy (pass , "s3cr3t" );
228
+ return 1 ;
229
+ //Add more users this way. Check against incrementing no for each user added.
230
+ // } else if (no==1) {
231
+ // os_strcpy(user, "user1");
232
+ // os_strcpy(pass, "something");
233
+ // return 1;
234
+ }
235
+ return 0 ;
236
+ }
237
+
0 commit comments