📄 piadmin.c
字号:
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This software is copyrighted by and is the sole property of
* VIA Networking Technologies, Inc. This software may only be used
* in accordance with the corresponding license agreement. Any unauthorized
* use, duplication, transmission, distribution, or disclosure of this
* software is expressly forbidden.
*
* This software is provided by VIA Networking Technologies, Inc. "as is"
* and any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose
* are disclaimed. In no event shall VIA Networking Technologies, Inc.
* be liable for any direct, indirect, incidental, special, exemplary, or
* consequential damages.
*
*
* File: piadmin.c
*
* Purpose: Password setting module UI callback functions
*
* Author: Tevin Chen
*
* Date: Jan 08, 2002
*
* Functions:
*
* Revision History:
*
*/
#include "str.h"
#include "piadmin.h"
#include "pieeprom.h"
#include "pidef.h"
#include "swmsg.h"
#include "pimisc.h"
#include "engine.h"
#include "allpages.h"
#include "platform.h"
#include "pigencfg.h"
#ifdef __MODULE_WEB_SMART
#include "weblib.h"
#endif
/*--------------------- Static Definitions -------------------------*/
#define EEP_ADDR_USERNAME (EEP_ADDR_ADM_CFG+1)
#define EEP_ADDR_PASSWORD (EEP_ADDR_ADM_CFG+1+USERNAME_STR_LEN)
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Macros -----------------------------*/
/*--------------------- Export Functions --------------------------*/
void PIADM_vInitPage(SAdmPageCfg* pSPageCfg_Admin) DIRECT_FUNTYPE_REENT
{
STRvMemset(pSPageCfg_Admin, 0, sizeof(SAdmPageCfg));
PIEEP_vGetCfgFromEep(EEP_ADDR_ADM_CFG, 1, &(pSPageCfg_Admin->byLoginEbl));
PIEEP_vGetCfgFromEep(EEP_ADDR_USERNAME, USERNAME_STR_LEN, (PBYTE)pSPageCfg_Admin->strEepromUsername);
PIEEP_vGetCfgFromEep(EEP_ADDR_PASSWORD, USERNAME_STR_LEN, (PBYTE)pSPageCfg_Admin->strEepromPasswd);
STRvStrcpy(pSPageCfg_Admin->strNewUsername, pSPageCfg_Admin->strEepromUsername);
STRvStrcpy(pSPageCfg_Admin->strNewPasswd, pSPageCfg_Admin->strEepromPasswd);
STRvStrcpy(pSPageCfg_Admin->strAgainPasswd, pSPageCfg_Admin->strEepromPasswd);
#ifdef __MODULE_WEB_SMART
WEBg_bLoginEbl = pSPageCfg_Admin->byLoginEbl;
#endif
}
void PIADM_vSetEepDefault(void) DIRECT_FUNTYPE_REENT
{
BYTE byValue = DEFAULT_LOGIN_ENABLE;
PIEEP_vSetCfgIntoEep(&byValue, EEP_ADDR_ADM_CFG, 1);
PIEEP_vSetCfgIntoEep(DEFAULT_ADM_USERNAME, EEP_ADDR_USERNAME, USERNAME_STR_LEN);
PIEEP_vSetCfgIntoEep(DEFAULT_ADM_PASSWORD, EEP_ADDR_PASSWORD, USERNAME_STR_LEN);
PIEEP_vUpdateChecksum();
}
BYTE PIbyADM_SavePage(SAdmPageCfg* pSPageCfg_Admin) DIRECT_FUNTYPE_REENT
{
PIEEP_vSetCfgIntoEep(&(pSPageCfg_Admin->byLoginEbl), EEP_ADDR_ADM_CFG, 1);
if (pSPageCfg_Admin->byLoginEbl)
{
if (STRcStrcmp(pSPageCfg_Admin->strNewPasswd, pSPageCfg_Admin->strAgainPasswd))
return ADMIN_OP_DIFF_AGAIN_PASSWORD;
PIEEP_vSetCfgIntoEep((PBYTE)pSPageCfg_Admin->strNewUsername, EEP_ADDR_USERNAME, USERNAME_STR_LEN);
PIEEP_vSetCfgIntoEep((PBYTE)pSPageCfg_Admin->strNewPasswd, EEP_ADDR_PASSWORD, USERNAME_STR_LEN);
}
PIEEP_vUpdateChecksum();
// after change password protection mode, the root page and auto logout should be modified.
if (pSPageCfg_Admin->byLoginEbl)
{
g_byRootPageID = PAGE_MAIN_MENU;
PIMISC_vStartAutoLogout();
}
else
{
g_byRootPageID = PAGE_MAIN_MENU_NOLOGOUT;
PIMISC_vStopAutoLogout();
}
PIADM_vInitPage(pSPageCfg_Admin); // re-init buffer to input again
return OP_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -