mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-01 13:10:43 +00:00
Change dash auth signature
This commit is contained in:
1 parent
e923b413ae
commit
73037880e6
7 files changed
+19
-12
No files matched your search
@@ -4,7 +4,7 @@
|
||||
#include "mongoose.h"
|
||||
|
||||
static struct mg_dash s_dash;
|
||||
static int authenticate(const char *user, const char *pass);
|
||||
static int authenticate(char *user, size_t userlen, const char *pass);
|
||||
|
||||
// Action buttons
|
||||
static bool s_action1, s_action2;
|
||||
@@ -176,14 +176,15 @@ static struct mg_field_set set_graph2 = {
|
||||
"graph2", fields_graph2, read_graph2, NULL, 0, 0, NULL,
|
||||
};
|
||||
|
||||
static int authenticate(const char *user, const char *pass) {
|
||||
static int authenticate(char *user, size_t userlen, const char *pass) {
|
||||
int level = 0; // Authentication failure
|
||||
if (strcmp(pass, "admin") == 0) {
|
||||
mg_snprintf(user, userlen, "%s", "admin");
|
||||
level = 7; // Administrator
|
||||
} else if (strcmp(pass, "user") == 0) {
|
||||
mg_snprintf(user, userlen, "%s", "user");
|
||||
level = 3; // Ordinary dude
|
||||
}
|
||||
(void) user;
|
||||
return level;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user