Skip to content

Commit 848c973

Browse files
authored
Test authBasic function
This should require you to enter a username & password to go into the WiFi pages on the esp. Use the following user & pass for testing admin s3cr3t
1 parent 08b75f9 commit 848c973

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

esp-link/main.c

+17-18
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,23 @@ bool ICACHE_FLASH_ATTR check_memleak_debug_enable(void)
5454
}
5555
#endif
5656

57+
//Function that tells the authentication system what users/passwords live on the system.
58+
//This is disabled in the default build; if you want to try it, enable the authBasic line in
59+
//the builtInUrls below.
60+
int myPassFn(HttpdConnData *connData, int no, char *user, int userLen, char *pass, int passLen) {
61+
if (no==0) {
62+
os_strcpy(user, "admin");
63+
os_strcpy(pass, "s3cr3t");
64+
return 1;
65+
//Add more users this way. Check against incrementing no for each user added.
66+
// } else if (no==1) {
67+
// os_strcpy(user, "user1");
68+
// os_strcpy(pass, "something");
69+
// return 1;
70+
}
71+
return 0;
72+
}
73+
5774
/*
5875
This is the main url->function dispatching data struct.
5976
In short, it's a struct with various URLs plus their handlers. The handlers can
@@ -217,21 +234,3 @@ user_init(void) {
217234
system_show_malloc();
218235
#endif
219236
}
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

Comments
 (0)