[Feature][R307L][task-view-1287][web] Customized requirement modification:ssid/key/logo/apn/dhcp address pool/Username and Password

Change-Id: I896be4e19fee4e896c8a5b17c094c28ba1dfe1cf
diff --git a/lynq/R307L/ap/app/goahead/interface5.0/zte_web_mgmt.c b/lynq/R307L/ap/app/goahead/interface5.0/zte_web_mgmt.c
index 1cc8689..69bbd34 100755
--- a/lynq/R307L/ap/app/goahead/interface5.0/zte_web_mgmt.c
+++ b/lynq/R307L/ap/app/goahead/interface5.0/zte_web_mgmt.c
@@ -165,31 +165,6 @@
 		return;
 	}
 
-	if (user != NULL) {
-		slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login  user = %s\n", user);
-		pUser = (char *)zte_base64_decode((const unsigned char *)user, strlen(user), (unsigned int*)&user_name_len);
-		if (NULL == pUser) {
-			zte_write_result_to_web(wp, LOGIN_FAIL);
-			return;
-		}
-
-		//strncpy(user_name, pUser, user_name_len);
-		if(user_name_len < sizeof(user_name))
-			snprintf(user_name,user_name_len+1,"%s",pUser);
-		else
-			snprintf(user_name,sizeof(user_name),"%s",pUser);
-		free(pUser);
-
-		slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login  user_name = %s\n", user_name);
-		cfg_get_item("admin_user", buf, sizeof(buf));
-		if (0 != strcmp(user_name, buf)) {
-			slog(MISC_PRINT, SLOG_ERR," zte_mgmt_login user_name fail \n");
-			zte_write_result_to_web(wp, LOGIN_USER_NAME_NOT_EXSIT);
-			return;
-		}
-		slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login uername correct \n");
-	}
-	slog(MISC_PRINT, SLOG_DEBUG,"[login] login1 -> zte_password_encode:%s.\n", psw); /*lint !e26*/
 #ifdef WEBS_SECURITY
 	zte_password = js_aes_decode(psw, strlen(psw), (unsigned int*)&zte_password_len);
 #else
@@ -218,6 +193,33 @@
 		return;
 	}
 
+	if (user != NULL) {
+		slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login  user = %s\n", user);
+		pUser = (char *)zte_base64_decode((const unsigned char *)user, strlen(user), (unsigned int*)&user_name_len);
+		if (NULL == pUser) {
+			zte_write_result_to_web(wp, LOGIN_FAIL);
+			return;
+		}
+
+		//strncpy(user_name, pUser, user_name_len);
+		if(user_name_len < sizeof(user_name))
+			snprintf(user_name,user_name_len+1,"%s",pUser);
+		else
+			snprintf(user_name,sizeof(user_name),"%s",pUser);
+		free(pUser);
+
+		slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login  user_name = %s\n", user_name);
+		cfg_get_item("admin_user", buf, sizeof(buf));
+		if (0 != strcmp(user_name, buf)) {
+			slog(MISC_PRINT, SLOG_ERR," zte_mgmt_login user_name fail \n");
+			zte_reduct_login_times();
+			zte_write_result_to_web(wp, LOGIN_USER_NAME_NOT_EXSIT);
+			return;
+		}
+		slog(MISC_PRINT, SLOG_DEBUG," zte_mgmt_login uername correct \n");
+	}
+	slog(MISC_PRINT, SLOG_DEBUG,"[login] login1 -> zte_password_encode:%s.\n", psw); /*lint !e26*/
+
 	//get request ip addr
 	ip_address = websGetRequestIpaddr(wp);
 #if 0 // kw 3	
diff --git a/lynq/R307L/ap/app/goahead/server/goahead.c b/lynq/R307L/ap/app/goahead/server/goahead.c
index 3fe84c3..ff083e1 100755
--- a/lynq/R307L/ap/app/goahead/server/goahead.c
+++ b/lynq/R307L/ap/app/goahead/server/goahead.c
@@ -282,12 +282,17 @@
 int web_check_pwd(char* buf)
 {
 	char psw_buf[LOGIN_PSW_MAX_LEN*3+1] = {0};
+	char imei[20] = {0};
+	char tmp[5] = {0};
 	if(buf == NULL)
 		return -1;
 	int bufLen = strlen(buf);
 	if(bufLen <= 0 || bufLen > LOGIN_PSW_MAX_LEN)
 		return -1;
 	cfg_get_item("admin_Password", psw_buf, sizeof(psw_buf));
+	cfg_get_item("imei", imei, sizeof(imei));
+	strncpy(tmp, imei + strlen(imei) - 4, 4);
+	strcat(psw_buf, tmp);
 	slog(MISC_PRINT,SLOG_DEBUG, "[goahead]check_pw in %s\n",buf);
 	slog(MISC_PRINT,SLOG_DEBUG, "[goahead]check_pw src %s\n",psw_buf);
 #ifdef WEBS_SSL_SUPPORT
diff --git a/lynq/R307L/ap/app/zte_comm/wlan/src/wlan_config_ssid.c b/lynq/R307L/ap/app/zte_comm/wlan/src/wlan_config_ssid.c
index ca89d23..d8dd222 100755
--- a/lynq/R307L/ap/app/zte_comm/wlan/src/wlan_config_ssid.c
+++ b/lynq/R307L/ap/app/zte_comm/wlan/src/wlan_config_ssid.c
@@ -25,8 +25,6 @@
 	CHAR m_ssid[40] = {0};
     CHAR ssid_cmd[128] = {0};
 	CHAR sLastbyte[3] = {0};
-	CHAR imei[20] = {0};
-	CHAR buf[6] = {0};
 	INT num = 0;
 	INT i = 0;
 	int ret = 0;
@@ -45,15 +43,7 @@
 	wf_log ("old ssid = %s", ssid);
 
 	strcpy (&last_mac[0], &s_mac[WLAN_MAC_ADDR_LEN - num]);
-	cfg_get_item("imei", imei, sizeof(imei));
-	while(strlen(imei) < 15)
-	{
-		wf_log ("atctl did not get imei now.");
-		wf_ms_sleep (1000);
-		cfg_get_item ("imei", imei, sizeof(imei));
-	}
-	strncpy(buf, imei + strlen(imei) - 5, 5);
-	strcat (ssid, buf);
+	strcat (ssid, last_mac);
 
 	if (strlen (ssid) > 32) {
 		wf_log ("mac_len error");
@@ -263,7 +253,7 @@
 {
 	int i = 0;
 	int random_index = 0;
-    const char charset[] = "abcdefghjkmnpqrstuwxyzACDEFGHJKLMNPQRSTUWXYZ2345679!@#%";
+    const char charset[] = "abcdefghjkmnpqrstuwxyzACDEFGHJKLMNPQRSTUWXYZ2345679";
     const int charsetSize = sizeof(charset) - 1; 
 
     if (str == NULL)
@@ -274,13 +264,13 @@
 
 	srand(seed);
 
-    for (i = 0; i < 8; i++) 
+    for (i = 0; i < 10; i++) 
 	{
         random_index = rand() % charsetSize;
         str[i] = charset[random_index];
     }
 
-    str[8] = '\0';
+    str[10] = '\0';
 
 	return;
 }
diff --git a/lynq/R307L/ap/app/zte_webui/i18n/Messages_en.properties b/lynq/R307L/ap/app/zte_webui/i18n/Messages_en.properties
index 56fce47..4add99f 100755
--- a/lynq/R307L/ap/app/zte_webui/i18n/Messages_en.properties
+++ b/lynq/R307L/ap/app/zte_webui/i18n/Messages_en.properties
@@ -526,6 +526,7 @@
 sms_save_tip = Saving...

 

 #login

+username = Username

 password = Password

 puk = PUK

 login = Login

@@ -533,8 +534,8 @@
 new_pin = New PIN

 confirm_pin = Confirm New PIN

 puk_locked = Your SIM card is locked permanently. Please contact your operator.

-password_error = Password is incorrect!

-password_error_left = Password is incorrect!<br/>You have {0} attempt(s) left.

+password_error = Username or password is incorrect!

+password_error_left = Username or password is incorrect!<br/>You have {0} attempt(s) left.

 password_error_account_lock = Your account is locked. <br/>Remaining time:

 password_error_five_times = You''ve input 5 times incorrectly. Retry in 5 minutes.

 password_error_account_lock_time = Your account is locked. <br/>Please try later.

diff --git a/lynq/R307L/ap/app/zte_webui/i18n/Messages_zh-cn.properties b/lynq/R307L/ap/app/zte_webui/i18n/Messages_zh-cn.properties
index 3e0e51e..170d3e4 100755
--- a/lynq/R307L/ap/app/zte_webui/i18n/Messages_zh-cn.properties
+++ b/lynq/R307L/ap/app/zte_webui/i18n/Messages_zh-cn.properties
@@ -528,6 +528,7 @@
 sms_save_tip = 保存草稿中...

 

 #login

+username = 用户名

 password = 密码

 puk = PUK

 login = 登录

@@ -535,8 +536,8 @@
 new_pin = 新 PIN

 confirm_pin = 确认新 PIN

 puk_locked = 您的 SIM卡已彻底锁定。请联系您的运营商。

-password_error = 密码不正确!

-password_error_left = 密码不正确!<br/>您的剩余尝试次数:{0}。

+password_error = 用户名或密码不正确!

+password_error_left = 用户名或密码不正确!<br/>您的剩余尝试次数:{0}。

 password_error_account_lock = 你的账户被锁定。<br/>剩余时间:

 password_error_five_times = 您已经输错5次。请5分钟后再试。

 password_error_account_lock_time = 您的账户已被锁定。<br/>请稍后再试。

diff --git a/lynq/R307L/ap/app/zte_webui/index.html b/lynq/R307L/ap/app/zte_webui/index.html
index f64166a..5b80559 100755
--- a/lynq/R307L/ap/app/zte_webui/index.html
+++ b/lynq/R307L/ap/app/zte_webui/index.html
@@ -25,11 +25,13 @@
 <div class="container" id="topContainer">

     <div id="langLogoBar" class="row">

         <div class="col-xs-4">

-            <a href="index.html" style="display: none;">

 			<script type="text/javascript">

-			document.write("<img src='pic/res_logo_web.png?random=" + Math.random() + "' />");

+			document.write("<img src='pic/Claro_shop.png?random=" + Math.random() + "' style='width: 17%; height: 16%;' />&nbsp;&nbsp;");

+			document.write("<img src='pic/Claro_video.png?random=" + Math.random() + "' style='width: 17%; height: 16%;' />&nbsp;&nbsp;");

+			document.write("<img src='pic/App_Claro.png?random=" + Math.random() + "' style='width: 17%; height: 16%;' />&nbsp;&nbsp;");

+			document.write("<img src='pic/Claro_drive.png?random=" + Math.random() + "' style='width: 17%; height: 16%;' />&nbsp;&nbsp;");

+			document.write("<img src='pic/Portal_Claro_ideas.png?random=" + Math.random() + "' style='width: 17%; height: 16%;' />");

 			</script>

-            </a>

             <!--span class="center-block" id="webui_title"></span-->

         </div>

         <div id="statusBar" style="display: none;" class="col-xs-8 text-right">

@@ -66,9 +68,7 @@
             </span>

             <span title="battery_level" i18n="true" data-bind="visible: hasBattery" class="statusItem"><img id="batteryCharging" data-bind="attr: {src: batteryPers}" class="paddingbottom6"/></span>

         </div>

-    </div>

-    <div id="manageBar" class="row">

-        <div id="manageContainer" class="col-xs-12 text-right">

+        <div id="statusBar" class="col-xs-8 text-right">

             <span id="logout">

                 <a data-trans="modify_password" href="#pwd_mode" data-bind="visible:showLogout()" class="margin-right-10"></a>

                 <a id="logoutlink" data-trans="logout" href="javascript:void(0)" data-bind="click:logout,visible:showLogout() " style="display: none;" class="margin-right-10"></a>

diff --git a/lynq/R307L/ap/app/zte_webui/js/com.js b/lynq/R307L/ap/app/zte_webui/js/com.js
index 73e9c0d..a6160de 100755
--- a/lynq/R307L/ap/app/zte_webui/js/com.js
+++ b/lynq/R307L/ap/app/zte_webui/js/com.js
@@ -91,7 +91,8 @@
         function prepare(values, isPost) {

             var obj = {

                 goformId: "LOGIN",

-                password: config.PASSWORD_ENCODE ? Base64.encode(values.password) : values.password

+                password: config.PASSWORD_ENCODE ? Base64.encode(values.password) : values.password,

+                username: config.PASSWORD_ENCODE ? Base64.encode(values.username) : values.username

             };

             return obj;

         }

@@ -8132,6 +8133,7 @@
             target.loginSecuritySupport = ko.observable(config.LOGIN_SECURITY_SUPPORT);

             target.newPIN               = ko.observable();			

             target.password             = ko.observable();

+            target.username             = ko.observable();

             target.PIN                  = ko.observable();

             target.pinNumber            = ko.observable(data.pinnumber);			

             target.PUK                  = ko.observable();

@@ -8191,6 +8193,7 @@
                 var ciphertext = "";

                 if (config.PASSWORD_ENCODE) {

 		    ciphertext = target.password();

+            var username = target.username();

 		} else {

                     var kparam = service.getDeviceInfoLow();

                     var tkey = CryptoJS.enc.Latin1.parse(kparam.skey);

@@ -8202,7 +8205,8 @@
                         }).toString();

 		}

                 service.login({

-                    password:ciphertext

+                    password:ciphertext,

+                    username: username

                 }, function (info) {

                     setTimeout(function () {

                         timer = loginStatusCheckingTimer();

@@ -8219,6 +8223,7 @@
                         logout.init();

                     } else {

                         target.password("");

+                        target.username("");

                         if(config.LOGIN_SECURITY_SUPPORT){

                             target.checkLoginData(function(){

                                 if (target.loginCount() == config.MAX_LOGIN_COUNT) {

@@ -8303,9 +8308,12 @@
             function setFocus(){

                 setTimeout(function () {

                     var txtAdmin = $('#txtAdmin:visible');

+                    var txtUser = $('#txtUser:visible');

                     var txtPIN = $('#txtPIN:visible');

                     var txtPUK = $('#txtPUK:visible');

-                    if (txtAdmin.length > 0) {

+                    if(txtUser.length > 0) {

+                        txtUser.focus();

+                    } else if (txtAdmin.length > 0) {

                         txtAdmin.focus();

                     } else if (txtPIN.length > 0) {

                         txtPIN.focus();

diff --git a/lynq/R307L/ap/app/zte_webui/pic/App_Claro.png b/lynq/R307L/ap/app/zte_webui/pic/App_Claro.png
new file mode 100755
index 0000000..7910b9a
--- /dev/null
+++ b/lynq/R307L/ap/app/zte_webui/pic/App_Claro.png
Binary files differ
diff --git a/lynq/R307L/ap/app/zte_webui/pic/Claro_drive.png b/lynq/R307L/ap/app/zte_webui/pic/Claro_drive.png
new file mode 100755
index 0000000..9eae53f
--- /dev/null
+++ b/lynq/R307L/ap/app/zte_webui/pic/Claro_drive.png
Binary files differ
diff --git a/lynq/R307L/ap/app/zte_webui/pic/Claro_shop.png b/lynq/R307L/ap/app/zte_webui/pic/Claro_shop.png
new file mode 100755
index 0000000..3028c32
--- /dev/null
+++ b/lynq/R307L/ap/app/zte_webui/pic/Claro_shop.png
Binary files differ
diff --git a/lynq/R307L/ap/app/zte_webui/pic/Claro_video.png b/lynq/R307L/ap/app/zte_webui/pic/Claro_video.png
new file mode 100755
index 0000000..8ea87f7
--- /dev/null
+++ b/lynq/R307L/ap/app/zte_webui/pic/Claro_video.png
Binary files differ
diff --git a/lynq/R307L/ap/app/zte_webui/pic/Portal_Claro_ideas.png b/lynq/R307L/ap/app/zte_webui/pic/Portal_Claro_ideas.png
new file mode 100755
index 0000000..7f681f2
--- /dev/null
+++ b/lynq/R307L/ap/app/zte_webui/pic/Portal_Claro_ideas.png
Binary files differ
diff --git a/lynq/R307L/ap/app/zte_webui/pic/res_logo_web.png b/lynq/R307L/ap/app/zte_webui/pic/res_logo_web.png
deleted file mode 100755
index 659b3d5..0000000
--- a/lynq/R307L/ap/app/zte_webui/pic/res_logo_web.png
+++ /dev/null
Binary files differ
diff --git a/lynq/R307L/ap/app/zte_webui/subpg/entry.html b/lynq/R307L/ap/app/zte_webui/subpg/entry.html
index b293ae8..53df5c4 100755
--- a/lynq/R307L/ap/app/zte_webui/subpg/entry.html
+++ b/lynq/R307L/ap/app/zte_webui/subpg/entry.html
@@ -16,6 +16,11 @@
 			</div>

             <div class="row form-group">

                 <div class="col-xs-8">

+                    <input id="txtUser" autocomplete="off" data-placeholder="username" data-bind="value:username, valueUpdate: 'keypress'"  maxlength="32" name="txtUser" style="border:2px solid rgb(221, 221, 221);" class="required form-control"/>

+                </div>

+            </div>

+            <div class="row form-group">

+                <div class="col-xs-8">

                     <input id="txtAdmin" autocomplete="off" data-placeholder="password" data-bind="value:password, valueUpdate: 'keypress'"  maxlength="32" name="txtAdmin" style="border:2px solid rgb(221, 221, 221);" type="password" class="required form-control"/>

                 </div>

                 <div class="col-xs-4">