|
|
@ -63,37 +63,30 @@ void Page_login::OnInputFieldContentChange(uint8_t bid, const char* text) { |
|
|
|
} |
|
|
|
|
|
|
|
void Page_login::OnLoginButtonClick(uint8_t bid, const char* userName, const char* passwd) { |
|
|
|
static CfgItermCache passwdcfgcache; |
|
|
|
|
|
|
|
//
|
|
|
|
ZLOGI(TAG, "try login %s %s", userName, passwd); |
|
|
|
bool suc = false; |
|
|
|
bool isadmin = false; |
|
|
|
if (strcmp(userName, getCfgStr(kusr_name0)) == 0 && strcmp(passwd, getCfgStr(kusr_passwd0)) == 0) { |
|
|
|
suc = true; |
|
|
|
isadmin = true; |
|
|
|
} else if (strcmp(userName, getCfgStr(kusr_name1)) == 0 && strcmp(passwd, getCfgStr(kusr_passwd1)) == 0) { |
|
|
|
suc = true; |
|
|
|
} else if (strcmp(userName, getCfgStr(kusr_name2)) == 0 && strcmp(passwd, getCfgStr(kusr_passwd2)) == 0) { |
|
|
|
suc = true; |
|
|
|
} else if (strcmp(userName, getCfgStr(kusr_name3)) == 0 && strcmp(passwd, getCfgStr(kusr_passwd3)) == 0) { |
|
|
|
suc = true; |
|
|
|
} else if (strcmp(userName, getCfgStr(kusr_name4)) == 0 && strcmp(passwd, getCfgStr(kusr_passwd4)) == 0) { |
|
|
|
suc = true; |
|
|
|
} else if (strcmp(userName, getCfgStr(kusr_name5)) == 0 && strcmp(passwd, getCfgStr(kusr_passwd5)) == 0) { |
|
|
|
suc = true; |
|
|
|
const char* curUsrPasswd = getPasswd(userName, &passwdcfgcache); |
|
|
|
if (!curUsrPasswd) { |
|
|
|
UIS->alert("Óû§²»´æÔÚ"); |
|
|
|
UIS->setVal(PAGE, OBJ(txtPasswd), ""); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (suc) { |
|
|
|
GSM->setLogin(isadmin, userName); |
|
|
|
UIS->chpage(pg_main); |
|
|
|
} else { |
|
|
|
if (strcmp(curUsrPasswd, passwd) != 0) { |
|
|
|
UIS->alert("ÃÜÂë´íÎó"); |
|
|
|
UIS->setVal(PAGE, OBJ(txtPasswd), ""); |
|
|
|
return; |
|
|
|
} |
|
|
|
UIS->setVal(PAGE, OBJ(txtPasswd), ""); |
|
|
|
} |
|
|
|
|
|
|
|
#if 0
|
|
|
|
void Page_login::unlogin() { |
|
|
|
ZLOGI(TAG, "unlogin"); |
|
|
|
GSM->setUnLogin(); |
|
|
|
UIS->chpage(PAGE); |
|
|
|
if (strcmp(userName, getCfgStr(kusr_name0)) == 0) { |
|
|
|
ZLOGI(TAG, "%s(admin) login success ", userName); |
|
|
|
GSM->setLogin(true, userName); |
|
|
|
} else { |
|
|
|
ZLOGI(TAG, "%s login success ", userName); |
|
|
|
GSM->setLogin(false, userName); |
|
|
|
} |
|
|
|
UIS->chpage(pg_main); |
|
|
|
UIS->setVal(PAGE, OBJ(txtPasswd), ""); |
|
|
|
return; |
|
|
|
} |
|
|
|
#endif
|