Merge "[Bugfix][R306BR][bug-view-1999][voice] add call forword info"
diff --git a/lynq/R305/ap/app/goahead/interface5.0/zte_web_mgmt.c b/lynq/R305/ap/app/goahead/interface5.0/zte_web_mgmt.c
index f0767ce..73af4c3 100755
--- a/lynq/R305/ap/app/goahead/interface5.0/zte_web_mgmt.c
+++ b/lynq/R305/ap/app/goahead/interface5.0/zte_web_mgmt.c
@@ -164,31 +164,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
@@ -217,6 +192,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/R305/ap/app/zte_webui/i18n/Messages_en.properties b/lynq/R305/ap/app/zte_webui/i18n/Messages_en.properties
index 7fd8a9a..b0aa772 100755
--- a/lynq/R305/ap/app/zte_webui/i18n/Messages_en.properties
+++ b/lynq/R305/ap/app/zte_webui/i18n/Messages_en.properties
@@ -536,6 +536,7 @@
 sms_save_tip = Saving...

 

 #login

+username = Username

 password = Password

 puk = PUK

 login = Login

@@ -543,8 +544,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/R305/ap/app/zte_webui/i18n/Messages_zh-cn.properties b/lynq/R305/ap/app/zte_webui/i18n/Messages_zh-cn.properties
index fc9c37a..4334a6c 100755
--- a/lynq/R305/ap/app/zte_webui/i18n/Messages_zh-cn.properties
+++ b/lynq/R305/ap/app/zte_webui/i18n/Messages_zh-cn.properties
@@ -538,6 +538,7 @@
 sms_save_tip = 保存草稿中...

 

 #login

+username = 用户名

 password = 密码

 puk = PUK

 login = 登录

@@ -545,8 +546,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/R305/ap/app/zte_webui/js/com.js b/lynq/R305/ap/app/zte_webui/js/com.js
index cc93b65..6f3f0a1 100755
--- a/lynq/R305/ap/app/zte_webui/js/com.js
+++ b/lynq/R305/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;

         }

@@ -8165,6 +8166,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();

@@ -8224,6 +8226,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);

@@ -8235,7 +8238,8 @@
                         }).toString();

 		}

                 service.login({

-                    password:ciphertext

+                    password:ciphertext,

+                    username: username

                 }, function (info) {

                     setTimeout(function () {

                         timer = loginStatusCheckingTimer();

@@ -8252,6 +8256,7 @@
                         logout.init();

                     } else {

                         target.password("");

+                        target.username("");

                         if(config.LOGIN_SECURITY_SUPPORT){

                             target.checkLoginData(function(){

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

@@ -8336,9 +8341,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/R305/ap/app/zte_webui/subpg/entry.html b/lynq/R305/ap/app/zte_webui/subpg/entry.html
new file mode 100755
index 0000000..53df5c4
--- /dev/null
+++ b/lynq/R305/ap/app/zte_webui/subpg/entry.html
@@ -0,0 +1,110 @@
+<div id="loginForms">

+    <div class="row margin-top-160 padding-bottom-50">

+        <div class="col-xs-3"></div>

+        <div class="col-xs-6" id="login-form-container">

+	<div id="loginContainer" class="login_frame form-horizontal margin-top-50 margin-bottom-50" data-bind="visible:pageState()!=4">

+		<form id="frmLogin" data-bind="visible:pageState()==0">

+            <div data-bind="visible: loginSecuritySupport() && accountLocked()" class="row form-group colorRed">

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

+                    <span data-trans="password_error_account_lock"></span> <span data-bind="text: leftUnlockTime"></span>

+                </div>

+            </div>

+            <div style="display: none;" class="row form-group">

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

+                    <label data-trans="password" for="txtAdmin"></label>

+                </div>

+			</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">

+                    <input id="btnLogin" class="btn btn-primary btn-block" data-trans="login" type="submit" formmethod="post" />

+                </div>

+            </div>

+            <div class="row form-group" data-bind="visible: showEntrance">

+                <div data-bind="visible: !sharePathInvalid()" class="col-xs-12">

+                    <span class="icon"><img src="pic/pic_red.png"></span>

+                    <span class="scan">

+                        <a data-trans="browse_sdcard" href="#httpshare_guest"></a>

+                    </span>

+                </div>

+                <div data-trans="sd_share_path_invalid" data-bind="visible: sharePathInvalid()" class="col-xs-12 colorRed"></div>

+                <div class="clear"></div>

+            </div>

+		</form>

+		<form id="frmPIN" data-bind="visible:pageState()==1">

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

+                <div class="prompt col-xs-6">

+                    <p data-trans="enter_pin"></p>

+                    <p data-bind="visible:pinNumber()>1" class="important-prompt marginbottom15">

+                        <span data-trans="attempts_left"></span> <span data-bind='text:pinNumber'></span>

+                    </p>

+                    <p class="important-prompt" data-bind="visible:pinNumber()==1" data-trans="last_enter_pin"></p>

+                </div>

+            </div>

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

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

+                    <label data-trans='pin' for='txtPIN'></label>

+                    <input id='txtPIN' name="txtPIN" autocomplete="off" data-bind="value:PIN, valueUpdate: 'keypress'" maxlength='8' type="password" class="required form-control" />

+                </div>

+            </div>

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

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

+                    <input id="btnPinApply" data-trans="next_step" type="submit" formmethod="post" class="btn btn-primary" />

+                </div>

+            </div>

+		</form>

+		<form id="frmPUK" data-bind="visible:pageState()==2">

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

+                <div class="prompt col-xs-6">

+                    <p data-trans="enter_puk"></p>

+                    <p data-bind="visible:pukNumber()>1" class="important-prompt">

+                        <span data-trans="attempts_left"></span> <span data-bind='text:pukNumber'></span>

+                    </p>

+                    <p data-bind="visible:pukNumber()==1" data-trans="last_enter_puk" class="important-prompt"></p>

+                </div>

+            </div>

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

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

+                    <label data-trans='puk' for='txtPUK'></label>

+					<input id='txtPUK' name="txtPUK" autocomplete="off" data-bind="value:PUK, valueUpdate: 'keypress'" maxlength='8' type="password" class="required form-control" />

+                </div>

+			</div>

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

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

+                    <label data-trans='new_pin' for='txtNewPIN'></label>

+					<input id='txtNewPIN' name="txtNewPIN" autocomplete="off" data-bind="value:newPIN, valueUpdate: 'keypress'" maxlength='8' type="password" class="required form-control" />

+                </div>

+			</div>

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

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

+                    <label data-trans='confirm_pin' for='txtConfirmPIN'></label>

+					<input id='txtConfirmPIN' name="txtConfirmPIN" autocomplete="off"

+						data-bind="value:confirmPIN, valueUpdate: 'keypress'" maxlength='8' type="password" class="required form-control"

+					/>

+                </div>

+			</div>

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

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

+					<input id="btnPUKApply" data-trans="next_step" type="submit" formmethod="post" class="btn btn-primary" />

+                </div>

+			</div>

+		</form>

+        <div data-bind="visible:pageState()==5" style="text-align: center;">

+            <img id="loadingImg" src="pic/res_loading.gif"/>

+        </div>

+		<div id="puk_locked" data-trans="puk_locked" data-bind="visible:pageState()==3" class="important-prompt prompt"></div>

+		<div class="login_bottom"></div>

+	</div>

+

+

+        </div>

+        <div class="col-xs-3"></div>

+    </div>

+</div>
\ No newline at end of file