whois.handle: TOTNET
whois.name: TOT Public Company Limited Bangkok
whois.cidrs: 125.24.73.0/24
whois.updated: 2008-09-04T00:00:00.000000
services.protocol: HTTP
services.transport_protocol: TCP
services.scan_time: 2025-07-28T03:49:36.516196
services.banner: HTTP/1.1 200 OK
  Content-Type: text/html; charset=utf-8
  X-Frame-Options: SAMEORIGIN
  Content-Security-Policy: frame-ancestors 'none'
  Content-Length: 83512
  X-Frame-Options: SAMEORIGIN
  Set-Cookie: JSESSIONID=deleted; Expires=Thu, 01 Jan 1970 00:00:01 GMT; Path=/; HttpOnly
  Connection: keep-alive
  
services.value: jquery
services.value: login-page
services.path: /
services.endpoint_type: HTTP
services.scan_time: 2025-07-28T03:49:36.516196
services.uri: http://125.24.73.63/
services.protocol: HTTP/1.1
services.status_reason: OK
services.key: X-Frame-Options
services.headers: SAMEORIGIN SAMEORIGIN
services.key: Content-Security-Policy
services.headers: frame-ancestors 'none'
services.key: Content-Type
services.headers: text/html; charset=utf-8
services.key: Set-Cookie
services.headers: JSESSIONID=deleted; Expires=Thu, 01 Jan 1970 00:00:01 GMT; Path=/; HttpOnly
services.key: Connection
services.headers: keep-alive
services.key: Content-Length
services.headers: 83512
services.html_tags: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
services.body: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  
  <head>
      <link rel="shortcut icon" type="image/x-icon" href="../img/favicon.ico"/>
      <link rel="stylesheet" href="../css/main.css"/>
      <link rel="stylesheet" href="../css/login.css"/>
      <link rel="stylesheet" href="../css/jquery.tpInput.css"/>
  	<link rel="stylesheet" href="../css/jquery.tpPassword.css"/>
      <script src="../js/jquery-1.8.3.min.js" type="text/javascript"></script>
      <script src="../js/lib.js" type="text/javascript"></script>
      <script type="text/javascript" src="../locale/language.js"></script>
      <script type="text/javascript" src="../js/oid_str.js"></script>
      <script type="text/javascript" src="../js/locale.js"></script>
      <script type="text/javascript" src="../js/encrypt.js"></script>
      <script type="text/javascript" src="../js/jquery.tpInput.js"></script>
  	<script type="text/javascript" src="../js/jquery.tpPassword.js"></script>
      <script type="text/javascript" src="../js/oid_str.js"></script>
      <script src="../js/cryptoJS.min.js" type="text/javascript"></script>
      <script src="../js/tpEncrypt.js" type="text/javascript"></script>
      <script src="../js/gdprProxy.js" type="text/javascript"></script>
  	    <style type="text/css">
          #pc-login-vcode {
              padding: 0 0 0 30px;
              display: inline-block;
              border: 1px solid #ccc;
              border-radius: 4px;
              outline-color: #ffffff;
              -webkit-box-sizing: border-box;
              -moz-box-sizing: border-box;
              box-sizing: border-box;
              width: 120px;
              height: 32px;
              line-height: 32px;
              font-size: 12px;
          }
          #pc-refresh-code {
              line-height: 32px;
              text-decoration: underline;
              color: #4acbd6;
              white-space: nowrap;
          }
          #pc-verify-btn, #pc-clear-btn {
              /*border: none;*/
              border-radius: 5px;
              /*color: #fff;*/
              height: 30px;
              /*line-height: 32px;*/
              width: 60px;
              /*background-color: #4acbd6;*/
              /*min-width: 90px;*/
              /*padding: 8px 6px 9px;*/
              cursor: pointer;
              box-sizing: border-box;
          }
          .button-verify-text {
              text-align: center;
              font-size: 14px;
              color: rgb(83, 74, 74);
          }
          #pc-vode {
              position: relative;
              display: inline-block;
          }
      </style>
      <!--[if lte IE 8]>
      <link href="./css/ie.css" rel="stylesheet" type="text/css"/>
      <style type="text/css">
          .input-err-container .input-err-delta, #pc-scroll div.widget-error-tips span.widget-error-tips-delta {
              top: 4px;
              left: 96px;
          }
  
          .input-container .input-err-container, .button-error-tips {
              left: -11px;
              top: 30px;
          }
  
          .input-container .input-wrapper {
              background: url("../img/ie.png") no-repeat -250px -226px;
              border: none;
              width: 186px;
              height: 33px;
          }
  
          .input-container.err .input-wrapper {
              background-position: -219px -173px;
              border: none;
          }
  
          .input-container.focus .input-wrapper {
              background-position: 1px -225px;
              border: none;
          }
  
          button.button-button {
              background: url("../img/ie.png") no-repeat -255px -32px;
          }
  
          button.button-button:hover {
              background: url("../img/ie.png") no-repeat 0px -32px;
          }
  
          #pc-scroll div.widget-error-tips div.widget-error-tips-wrap, .input-err-container .input-err-content {
              border: 0;
              box-shadow: none;
          }
  
          .shadow-top {
              background: url("../img/ie-01.png") repeat-x 0 -5px;
              top: -13px;
              left: 0;
              height: 13px;
              margin: 0 17px 0 17px;
          }
  
          .shadow-bot {
              background: url("../img/ie-01.png") repeat-x center bottom;
              bottom: -13px;
              left: 0;
              height: 13px;
              margin: 0 17px 0 17px;
          }
  
          .shadow-top-left, .shadow-top-right, .shadow-bot-left, .shadow-bot-right {
              position: absolute;
              width: 17px;
              height: 11px;
              background: url(../img/ie-06.png) no-repeat 0px -56px;
          }
  
          .shadow-top-left {
              background-position: 0px -56px;
              left: 4px;
              top: 4px;
          }
  
          .shadow-top-right {
              background-position: 0px -38px;
              right: 0;
              top: 3px;
          }
  
          .shadow-bot-left {
              background-position: 0px -76px;
              left: 3px;
              bottom: 8px;
          }
  
          .shadow-bot-right {
              background-position: 0px -95px;
              right: 0;
              bottom: 8px;
          }
  
          .shadow-left {
              padding-left: 11px;
              background: url(../img/ie-02.png) no-repeat 0px 0px;
          }
  
          .shadow-right {
              padding-right: 11px;
              background: url(../img/ie-02.png) no-repeat center right;
          }
  
      </style>
      <![endif]-->
  </head>
  
  <body>
  <div id="cover" class="nd"></div>
  <div id="mask" class="mask"></div>
  <span class="load" style="display: none">for cache</span>
  
  <div id="pc-div">
  	<div id="pc-top">
  		<div id="pc-top-container">
  		</div>
  	</div>
  	<div id="pc-scroll">
  		<div id="pc-main">
  			<div class="pc-login-content" id="pc-login">
  		            <div class="pc-login-field">
                  <img src="../img/c_internet.png" width="200px" />
              </div>
  		            <div class="pc-login-field img_div">			
                  <img src="../img/TP-logo.png" width="60px" style="margin: 0px -120px 0px 0px" />
  				</div>
  				<div id="pc-login-main">
  					<div class="pc-login-field nd" id="pc-login-user-div">
  						<div class="pc-inputarea">
  							<label class="pc-login-username-label">
  								<span class="icon"></span>
  								<span class="text"></span>
  							</label>
  							<input type="text" id="pc-login-user" autocomplete="off" />
  						</div>
  					</div>
  					<div class="pc-login-field">
  						<div class="pc-inputarea">
  							<label class="pc-login-password-label">
  								<span class="icon"></span>
  							</label>
  							<input type="password" id="pc-login-password" autocomplete="off" />
  					    </div>
  
  					</div>
  
             <div class="pc-login-field">
  
                 <img id="pc-vcode-img" src="../img/codes/code.gif">
  
                  <div>
  
                      <span>Enter the code above here:</span>
  
                  </div>
  
                  <div id="pc-vode">
  
                      <label class="pc-login-code-label">
  
                          <span class="icon" id="pc-code-label"></span>
  
                      </label>
  
                      <input type="text" id="pc-login-vcode" autocomplete="off" maxlength=7 class="tpInput" >
  
                  </div>
  
                  <div>
  
                  <span>Can't read the image ? click <a href="#" id="pc-refresh-code">here</a> to refresh</span>
  				</div>
  			</div>
  					<div id="pc-login-submit">
  						<div class="button-wrapper">
  							<button id="pc-login-btn" class="button-button" type="button">
  								<span class="text button-text">Log in</span>
  							</button>
  							<div class="button-error-tips widget-error-tips">
  								<div class="shadow-top-left"></div>
  								<div class="shadow-top"></div>
  								<div class="shadow-top-right"></div>
  								<div class="shadow-left">
  									<div class="shadow-right">
  										<span class="widget-error-tips-delta"></span>
  
  										<div class="widget-error-tips-wrap">
  											<div class="content error-tips-content">
  												<span id="errorContent"></span>
  											</div>
  										</div>
  									</div>
  								</div>
  								<div class="shadow-bot-left"></div>
  								<div class="shadow-bot"></div>
  								<div class="shadow-bot-right"></div>
  							</div>
  						</div>
  					</div>
  				</div>
  			</div>
  
  			<div class="pc-login-content nd" id="pc-setPwd">
  				<div class="pc-login-field">
  					<div class="pc-inputarea">
  						<label class="pc-login-password-label">
  							<span class="icon"></span>
  						</label>
  						<input type="password" id="pc-setPwd-new" autocomplete="off" />
  					</div>
  					<div style='text-align:left'> 
  						<li class="T_haveSpace nd" id="t_haveSpace" style='color:red'> 
  							<span style='color:grey' id="t_pwMustNoSpace"> Must contain no space(s)</span> 
  						</li>
  						<li class="T_passwordLen nd" id="t_passLen" style='color:red'> 
  							<span style='color:grey' id="t_pwMustLength"> Must be 6-32 character long</span> 
  						</li>
  						<li class="T_passwordType nd" id="t_passType" style='color:red'> 
  							<span style='color:grey' id="t_pwMust2Type"> Must contain two types of characters</span> 
  						</li> 
  					</div>
  				</div>
  				<div id="pwdCheck" class="secLevel">
  					<span id="pwdCheck-low" class="level1 ori">Low</span>
  					<span id="pwdCheck-middle" class="level2 ori">Middle</span>
  					<span id="pwdCheck-high" class="level3 ori">High</span>
  				</div>
  				<div class="pc-login-field">
  					<div class="pc-inputarea">
  						<label class="pc-login-password-label">
  							<span class="icon"></span>
  						</label>
  						<input type="password" id="pc-setPwd-confirm" autocomplete="off" />
  					</div>
  				</div>
  
  				<div >
  					<center>
  						<span style='color:red' class="T_passwordFormat nd" id="t_passFormat">The password must consist of letters numbers and special characters, <br> including at least two of types. it's length must be 6 to 32 and It cannot contain spaces</span>
  					</center>
  				</div>
  
  				<div>
  					<div class="button-wrapper">
  						<button id="pc-setPwd-btn" class="button-button" type="button">
  							<span class="text button-text">Log in</span>
  						</button>
  						<div class="button-error-tips widget-error-tips">
  							<div class="shadow-top-left"></div>
  							<div class="shadow-top"></div>
  							<div class="shadow-top-right"></div>
  							<div class="shadow-left">
  								<div class="shadow-right">
  									<span class="widget-error-tips-delta"></span>
  
  									<div class="widget-error-tips-wrap">
  										<div class="content error-tips-content">
  											<span id="errorContent"></span>
  										</div>
  									</div>
  								</div>
  							</div>
  							<div class="shadow-bot-left"></div>
  							<div class="shadow-bot"></div>
  							<div class="shadow-bot-right"></div>
  						</div>
  					</div>
  				</div>
  			</div>
  			<div id="pc-cloud" class="nd">
  				<div id="cloud-bind-main" class="pc-login-content nd" >
  					<div id="login-bind-note-cnt">
  						<span class="text" id="login-bind-note"></span>
  					</div>
  					<div class="login-field">
  						<div id="cloud-bind-user-div" class="pc-login-field nd" >
  							<div class="pc-inputarea">
  								<label class="pc-login-username-label">
  									<span class="icon"></span>
  									<span class="text"></span>
  								</label>
  								<input type="text" id="cloud-bind-user" autocomplete="off" />
  							</div>
  						</div>
  					</div>
  					<div class="pc-login-field">
  						<div class="pc-inputarea">
  							<label class="pc-login-password-label">
  								<span class="icon"></span>
  								<span class="text"></span>
  							</label>
  							<input type="password" id="cloud-bind-password" autocomplete="off" />
  						</div>
  					</div>
  					<div>
  						<div class="button-wrapper">
  							<button id="cloud-bind-btn" class="button-button" type="button">
  								<span class="text button-text">Bind</span>
  							</button>
  							<div class="button-error-tips widget-error-tips">
  								<div class="shadow-top-left"></div>
  								<div class="shadow-top"></div>
  								<div class="shadow-top-right"></div>
  								<div class="shadow-left">
  									<div class="shadow-right">
  										<span class="widget-error-tips-delta"></span>
  
  										<div class="widget-error-tips-wrap">
  											<div class="content error-tips-content">
  												<span class="errorContent"></span>
  											</div>
  										</div>
  									</div>
  								</div>
  								<div class="shadow-bot-left"></div>
  								<div class="shadow-bot"></div>
  								<div class="shadow-bot-right"></div>
  							</div>
  						</div>
  					</div>
  				</div>
  				<div id="bound-error" class="nd">
  					<div class="note"></div>
  					<div class="switch-btn"></div>
  				</div>
  				<iframe frameborder="0" id="cloud-login" name="cloud-login" scrolling="no" class="nd"></iframe>
  			</div>
  		<div class="pc-login-field">
          <img src="../img/cat_note.png" style="MARGIN: -30px -10px 0px -10px" width="400">
          </div>
  		</div>
  		<div id="pc-bottomContainer">
  			<div id="pc-bottom">
  				<span id="pc-bot-productName"></span>
  				<span id="pc-bot-modelDesc"></span>
  			</div>
  			<div class="pc-bottom-background"></div>
  		</div>
  	</div>
  
  </div>
  <div id="alert-container"
       class="alert-container widget-container msg-container grid-popup-msg msg-container-center">
      <div class="msg-container-wrapper">
          <div class="position-top-left"></div>
          <div class="position-top-center"></div>
          <div class="position-top-right"></div>
          <div class="position-center-left">
              <div class="position-center-right">
                  <div class="msg-wrap"><a class="widget-close msg-close" href="javascript:void(0);"></a>
  
                      <div class="msg-content-wrap">
                          <div class="widget-content msg-content-container">
                              <div class="grid-warning-msg">
  								<span class="icon"></span>
  								<span class="text">The device will reboot. Are you sure to continue?</span>
                              </div>
                          </div>
                      </div>
                  </div>
                  <div class="msg-btn-container">
                      <div class="msg-btn-wrap">
                          <div class="button-container in-line">
                              <button type="button" class="button-button green pure-button btn-msg btn-msg-no btn-confirm"
                                      id="confirm-no">
                                  <span>No</span>
  							</button>
                          </div>
                          <div class="button-container in-line">
                              <button type="button" class="button-button green pure-button btn-msg btn-msg-ok btn-confirm"
                                      id="confirm-yes">
                                  <span>Yes</span>
  							</button>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
          <div class="position-bottom-left"></div>
          <div class="position-bottom-center"></div>
          <div class="position-bottom-right"></div>
      </div>
  </div>
  <div id="welcome" class="nd">
      <div class="wel-top">
          <div class="icon-router sprite o-network-router"></div>
          <div id="wel-usb" class="sprite icon icon-usb e-welcome-usb"></div>
          <div id="wel-wireless" class="sprite icon icon-wireless e-welcome-wireless"></div>
          <div id="wel-internet" class="sprite icon icon-internet e-welcome-internet"></div>
          <div id="wel-guest" class="sprite icon icon-guest e-welcome-guest"></div>
          <div id="wel-device" class="sprite icon icon-device e-welcome-device"></div>
          <div id="wel-phone" class="sprite icon icon-phone e-welcome-phone"></div>
      </div>
      <div id="wel-logo" class="sprite n-logoPhone"></div>
      <div class="company">TP-Link Corporation Limited<br>All rights reserved</div>
  </div>
  <div id="ph-div" style="display: none;">
      <div class="ph-header">
          <div class="ph-logo">
          </div>
          <!--<div style="text-align: center"><span id="ph-productName" class="ph-productName"></span></div>-->
      </div>
      <div class="ph-form">
          <form id="ph-setPwd">
              <div class="form-line">
                  <span class="sprite c-login-password"></span>
                  <input type="password" id="ph-setPwd-new" class="form-inputText" placeholder="New Password"
                         autocomplete="off" />
  
                  <div class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP">errTips</p>
                  </div>
                  <div id="passwordLevelP" class="password-level">
                      <span id="pwdCheckP-low" class="low">Low</span>
                      <span id="pwdCheckP-middle" class="middle">Middle</span>
                      <span id="pwdCheckP-high" class="high">High</span>
                  </div>
              </div>
  
              <div class="mt11 form-line">
                  <span class="sprite c-login-password"></span>
                  <input type="password" id="ph-setPwd-confirm" class="form-inputText" placeholder="Confirm Password"
                         autocomplete="off" />
  
                  <div class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP">errTips</p>
                  </div>
              </div>
  
              <div class="form-line mt20">
                  <input type="button" id="ph-setPwd-btn" class="form-lgBt" value="Save" />
  
                  <div id="ph-setPwd-note" class="noteDivP mt11">
                      <p class="errTextP">errTips</p>
                  </div>
              </div>
          </form>
          <form id="ph-login" class="nd">
              <div class="mt11 form-line nd" id="ph-login-user-div">
                  <span class="sprite c-login-account"></span>
                  <input type="password" id="ph-login-user" class="form-inputText" placeholder="Username"
                         autocomplete="off" />
  
                  <div class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP"></p>
                  </div>
              </div>
              <div class="mt11 form-line">
                  <span class="sprite c-login-password"></span>
                  <input type="password" id="ph-login-password" class="form-inputText" placeholder="Password"
                         autocomplete="off" />
  
                  <div class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP"></p>
                  </div>
              </div>
  
  
              <div class="form-line mt20">
                  <input type="button" id="ph-login-btn" class="form-lgBt" value="Login" />
  
                  <div id="ph-login-note" class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP">errTips</p>
                  </div>
              </div>
          </form>
      </div>
      <div class="ph-bot">
          <a href="javascript:void(0);" id="pb-phone" class="ph-bot-phone selected"></a>
          <span>|</span>
          <a href="javascript:void(0);" id="pb-pc" class="ph-bot-pc"></a>
      </div>
  </div>
  <!-- bugfix: firefox: login in ok but can NOT access content -->
  <div id="preload"><span class="preload"></span></div> 
  <script type="text/javascript">
  $(function () {
      var INCLUDE_LOGIN_USERNAME = 0;
      if(!INCLUDE_CHGINIT_PWD || !INCLUDE_AUTH_PASSWORD)
          var INCLUDE_LOGIN_USERNAME = 1;      //控制普通登录是否有用户名
  	var isPhoneUI = false;
      var cloudLogined = false;
  	var isCloudBind = false;
      var HTTP_ERR_USER_PWD_NOT_CORRECT = 71233;
  	
      $.userInfo={};
  	localStorage.removeItem("userInfo");
      if (location.protocol != "https:") {
          //if local https function is enable and protocol is no https:, jump to https;
          if ('httpsLocalEnabled' in window && httpsLocalEnabled == '1') {
              window.location.href = "https://" + location.hostname + (('httpsLocalPort' in window && httpsLocalPort == "") ? "" : (":" + httpsLocalPort));
          }
      }
      /*=================================
       *multi language
       ===================================*/
      try {
          $.locale.load(locale_language, null, null, true);
      } catch (e) {
      }
  //set text and html with $.tpLang
  
      var timesText = $.tpLang.login.timesText;
  
      //$('#pc-cloud-password').prop('type', 'password');
  
      $('#pc-top-product').attr('href', $.su.CHAR.SUPPORT[$.locale.locale.toUpperCase()]);
      $('#pc-login-btn,#pc-cloud-btn').html('<span class="text button-text">' + $.tpLang.login.login + '</span>');
      $('#pc-setPwd-btn').html('<span class="text button-text">' + $.tpLang.login.save + '</span>');
      $('#pwdCheck-low').html($.tpLang.login.low);
      $('#pwdCheck-middle').html($.tpLang.login.middle);
      $('#pwdCheck-high').html($.tpLang.login.high);
      $('#pc-login-password').tpInput();
      $('#pc-login-user').tpInput({
          placeholder: $.tpLang.login.userName
      });
  
      $('#pc-setPwd-new').tpInput({
          placeholder: $.tpLang.login.newPassword
      });
      $('#pc-setPwd-confirm').tpInput({
          placeholder: $.tpLang.login.confirmPassword
      });
  
  	$('#pc-login-password').tpPassword({
          placeholder: $.tpLang.login.password
      });
  //phone
      $('#pb-phone').html($.tpLang.login.phone);
      $('#pb-pc').html($.tpLang.login.pc);
  
      $('#ph-setPwd-new').attr('placeholder', $.tpLang.login.newPassword);
      $('#ph-setPwd-confirm').attr('placeholder', $.tpLang.login.confirmPassword);
      $('#pwdCheckP-low').html($.tpLang.login.low);
      $('#pwdCheckP-middle').html($.tpLang.login.middle);
      $('#pwdCheckP-high').html($.tpLang.login.high);
      $('#ph-setPwd-btn').prop('value', $.tpLang.login.save);
  
      $('#ph-login-user').attr('placeholder', $.tpLang.login.userName);
      $('#ph-login-password').attr('placeholder', $.tpLang.login.password);
      $('#ph-login-btn').attr('value', $.tpLang.login.login);
      var PCSubWin = function () {
      };
      try {
          if (modelName) {
              document.title = modelName;
              $("#pc-bot-productName").html(modelName);
              $("#pc-bot-modelDesc").html(modelDesc || '');
              //for phone
              $("#ph-productName").html(modelName);
  
          }
      } catch (e) {
      }
  
      /*=============================
       *logic
       * =============================*/
      var isLocked = false;
      var isMF = 0;     //isMobileFlag
  
  
      $('body').on('keydown', function (event) {
          if (event.keyCode == 13) {
  		    verify();
  
              setTimeout(function(){
  
                  if (isVerified == false) {
  
                      $('#pc-login-vcode').focus();
  
  					tpAlert("The input of verification is error, please check and input again!",null,null,null,null);
  
                      return;
  
                  }
  
                  loginSubmit();},500);
              PCSubWin(isMF);
          }
      });
  
  
  	$('#pc-login-password').next('input').on('keydown', function (event) {
          if (event.keyCode == 13) {
              PCSubWin(isMF);
          }
      });
      $('#cloud-bind-password').next('input').on('keydown', function (event) {
          if (event.keyCode == 13) {
              PCSubWin(isMF);
          }
      });
  
      function buttonError(obj, text, notHide) {
          var tip = $(obj).next('.widget-error-tips');
          if (text === false) {
              tip.hide();
              return;
          }
          if (tip.length == 0) {
              tip = $('<div class="button-error-tips widget-error-tips"><span class="widget-error-tips-delta"></span><div class="widget-error-tips-wrap"><div class="content error-tips-content"><span id="errorContent"></span></div></div></div>').insertAfter($(obj));
          }
          tip.show().find('#errorContent').html(text);
          $('body').off('click.buttonError');
          if (notHide !== true) {
              $('body').on('click.buttonError', function () {
                  tip.hide();
                  $('body').off('click.buttonError');
              });
          }
      }
  
      var rsaEncrypt = $.rsa.encrypt;
  
  
      function lockWeb(bLock) {
          $("#pc-login-password").tpInput('disabled', bLock);
          $("#pc-login-user").tpInput('disabled', bLock);
          //for phone
          $("#ph-login-password").prop('disabled', bLock);
          $("#ph-login-user").prop('disabled', bLock);
  
          //cloud
          $("#cloud-bind-password").tpInput('disabled', bLock);
          $("#cloud-bind-user").tpInput('disabled', bLock);
  		$("#cloud-bind-password").tpInput('disabled', bLock);
      }
  
      function getHttpObject(hook) {
          var xmlHttp = null;
          try {
              xmlHttp = new XMLHttpRequest();
          } catch (e) {
              try {
                  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
              } catch (e) {
                  try {
                      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                  } catch (e) {
                      /* How to handle this error? */
                  }
              }
          }
          xmlHttp.onreadystatechange = function () {
              if (xmlHttp.readyState == 4) {
                  if (hook)
                      hook();
              }
          };
          return xmlHttp;
      }
  
      var n;
      var e;
      var s;
      var us; //userSetting
      var as; //adminSetting
      var oldVerifyCode; //record old code
  
      /**
       * get userSetting、ee、nn
       */
      function getAuthParm() {
          var xmlHttpObj;
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  return;
  
              } else {
                  if (INCLUDE_USER_RESTRICTION) {
                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                  } else {
                      window.location.href = window.location.protocol + "//" + window.location.host;
                  }
              }
          });
  
          //bAsync must be set False to waiting entire response is received.
          xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getGDPRParm", false);
          xmlHttpObj.send(null);
          eval(xmlHttpObj.responseText);
          if (INCLUDE_LOGIN_GDPR_ENCRYPT)
          {
              try{
                  $.newencryptorManager = $.encrypt.encryptManager;
                  $.Iencryptor =  $.newencryptorManager.getEncryptor();
              }
              catch(e)
              {
              	
              }
  
              $.nn = nn;
              $.ee = ee;
              $.seq = seq;
  			$.Iencryptor.setSeq($.seq);
  			$.Iencryptor.setRSAKey($.nn, $.ee);
  	
          }
          else if(INCLUDE_SSL)
          {
              n = nn;
              e = ee;
          }
          else
          {
              s=ss;
          }
          us = userSetting;
          if (INCLUDE_USER_RESTRICTION) {
              as = adminSetting;
          }
          if (logoUrl != '') {
              $('#pc-top-product').attr('href', logoUrl);
          }
      }
  
      function getBusy(callback) {
          var xmlHttpObj;
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  eval(xmlHttpObj.responseText);
                  callback.call(null, {
                      isLogined: isLogined,
                      isBusy: isBusy
                  });
  
              } else {
                  if (INCLUDE_USER_RESTRICTION) {
                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                  } else {
                      window.location.href = window.location.protocol + "//" + window.location.host;
                  }
              }
          });
  
          //bAsync must be set False to waiting entire response is received.
          xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getBusy", callback? true: false);
          xmlHttpObj.send(null);
  
          if (callback === undefined) {
              eval(xmlHttpObj.responseText);
              return {
                  isLogined: isLogined,
                  isBusy: isBusy
              }
          }
  
      }
  
      /*==================================
       *js for phone
       ====================================*/
      $('#pb-pc').on('click', function () {
          document.cookie = 'UserChange=true';
          isMF = 0;
          $('#viewport').attr('content', '');
          initPC();
      });
  
      $('#ph-setPwd-new, #ph-setPwd-confirm, #ph-login-user, #ph-login-password').on('focus', function () {
          $(this).removeClass('err').next('div.errDivP').hide();
      });
      /**
       * 给文本框显示或隐藏提示
       * @param obj {jQuery} input
       * @param text {string/boolean} 为字符串是显示提示，等于false时隐藏提示
       * @param isMobile {boolean} true表示手机
       */
      function inputError(obj, text, isMobile) {
          if (text === false) {
              if (isMobile) {
                  $(obj).removeClass('err').next('div.errDivP').hide();
              } else {
                  $(obj).tpInput('hideError');
              }
          } else {
              if (isMobile === true) {
                  $(obj).addClass('err').next('div.errDivP').show().find('.errTextP').html(text);
              } else {
                  $(obj).tpInput('showError', text);
              }
          }
  
      }
  
      $('#pb-phone').on('click', function () {
          $.deleteCookie("UserChange");
      });
  
      /*============================================
       *init
       ==============================================*/
      if (document.getElementById("mainBody") != null) {
          (function(domain, port, frame, page) {
              if ($.local) {
                  location.reload(true);
              } else {
                  var ret = window.parent.location.href.match(/(https?):\/\/([^:\/]+)(:\d+)?\/?([^?]*)/);
                  window.parent.location.href = ret[1] + "://" + (domain ? domain : ret[2]) + (port ? ":" + port : (ret[3] ? ret[3] : "")) + "/" + (frame ? frame : (ret[4] ? ret[4] : "")) + (page ? "#__" + page.match(/\w+\.htm$/) : "");
              }
          })();
      }
  
      /*==========================================
       * code for setPwd
       ==========================================*/
      var pwdCheckOK = false;
      $('#pc-setPwd-btn').on('click', function () {
          setPwdSubmit();
      });
      $("#pc-setPwd-new").on('keyup', function () {
          checkPwd();
      });
  	
  	
  	function checkNewPassword(){
  		var password = $("#pc-setPwd-new").prop('value');
  
  		if(password.length == 0)
  		{
  			return false;
  		}
  		if((password.length > 32) || (password.length < 6))
  		{
  			$('#t_passLen').removeClass("nd");
  			return false;
  		}
  		if (password.indexOf(" ") != -1) {
  			$('#t_haveSpace').removeClass('nd');
  			return  false;
  		}
  		if(/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]/.test(password) == false)
  		{
  			$('#t_passType').removeClass('nd');
  			return false;
  		}
  		return true;
  	}
  
      function pcCheckNewPassword()
      { 
          var password = $("#pc-setPwd-new").prop('value'); 
          var err = false; 
          if((password.length > 32) || (password.length < 6))
          { 
              $('#t_passLen').removeClass("nd"); 
              err = true; 
          }
          if (password.indexOf(" ") != -1) 
          { 
              $('#t_haveSpace').removeClass('nd'); 
              err = true; 
          }
          if(/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]/.test(password) == false) 
          { 
              $('#t_passType').removeClass('nd'); 
              err = true; 
          }
          if(err == true) 
              $('#pc-setPwd-new').tpInput('showError',""); 
      }
      function showNewPasswordProblem()
      { 
          var password = $("#pc-setPwd-new").prop('value');
          $('#t_passLen').removeClass("nd"); 
          $('#t_haveSpace').removeClass('nd');
          $('#t_passType').removeClass('nd');
          if((password.length > 32) || (password.length < 6))
          { 
              $('#t_passLen').css("color","red");
          }
          else{ 
              $('#t_passLen').css("color","green"); 
          }
          if (password.indexOf(" ") != -1) 
          { 
              $('#t_haveSpace').css("color","red"); 
          }
          else
          { 
              $('#t_haveSpace').css("color","green"); 
          }
          if(/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]/.test(password) == false)
          { 
              $('#t_passType').css("color","red"); 
          }
          else
          { 
              $('#t_passType').css("color","green"); 
          }
          return true; 
      }
  
  
  	$('#pc-setPwd-new').focus(function () {
  
  		$('#t_pwMust2Type').html($.tpLang.s_str.pwMust2Type);
  		$('#t_pwMustNoSpace').html($.tpLang.s_str.pwMustNoSpace);
  		$('#t_pwMustLength').html($.tpLang.s_str.pwMustLength);
  		$('#t_passFormat').html($.tpLang.s_str.passwordFormat);
  		showNewPasswordProblem();
  		
  	});
  	
  	$('#pc-setPwd-new').blur(function () {
          $('#t_passType').addClass("nd");
          $('#t_haveSpace').addClass("nd");
          $('#t_passLen').addClass("nd");
  		pcCheckNewPassword();
  	});
  	
      $('#pc-setPwd-new').keyup(function ()
      { 
          showNewPasswordProblem(); 
      });
  
  //for setPwd phone
      $('#ph-setPwd-btn').on('click', function () {
          setPwdSubmit(true);
      });
  
  	$('#ph-setPwd-new').focus(function () {
  		$('#t_passType').addClass('nd');
  		$('#t_haveSpace').addClass('nd');
  		$('#t_passLen').addClass("nd");
  		$('#t_passFormat').removeClass("nd");
  	});
  	
  	$('#ph-setPwd-new').blur(function () {
  		$('#t_passFormat').addClass("nd");
  		checkNewPassword();
  	});
  	
      function doSetPassword(pwd,callback) {
          var xmlHttpObj;
  
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  if (INCLUDE_USER_RESTRICTION) {
                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                  } else {
                      window.location.href = window.location.protocol + "//" + window.location.host;
                  }
              } else {
                  return;
              }
          });
          if (!INCLUDE_LOGIN_USERNAME && INCLUDE_USER_RESTRICTION) {
              var user = adminType == "admin" ? 'admin' : 'user';
              var preUser = encodeURIComponent($.Base64Encoding(user));
              var prePwd = encodeURIComponent($.Base64Encoding(pwd));
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/setPwd?pwd=" + prePwd + "&UserName=" + preUser, true);
  
          } else {
              var prePwd = encodeURIComponent($.Base64Encoding(pwd));
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/setPwd?pwd=" + prePwd, true);
          }
   		xmlHttpObj.send(null);
  
          //if(callback)
          //{
          //    callback();  
          //}
  
          
      }
  
      var setPwdSubmit = function (isMobile) {
          var $password = $("#pc-setPwd-new");
          var $confirm = $("#pc-setPwd-confirm");
          var value = $password.val();
          var confirmValue = $confirm.val();
          if (isMobile === true) {
              $password = $("#ph-setPwd-new");
              $confirm = $("#ph-setPwd-confirm");
              value = $password.val();
              confirmValue = $confirm.val();
          }	
  		
  		getAuthParm();
  		
  		if (INCLUDE_USER_RESTRICTION) {
  			if (adminType == "admin") {
  				us = as;
  			} else if (adminType == "user") {
  				us = us;
  			}
  			
  			switch (us) {
  			case 0:
  			case 3:
  				break;
  			default:
  				alert(e_str[ERR_USER_PWD_RESET_REPEAT]);
  				setTimeout(function() {
  					initLogin();
  				}, 300);	
  				return;
  			}
  		}
  
  		if(value.length == 0)
  		{
  			return alert(e_str[CMM_USER_PWD_FORMAT_ERR]);
  		}
  		if((value.length > 32) || (value.length < 6))
  		{
  			return inputError($confirm, e_str[CMM_USER_PWD_FORMAT_ERR], isMobile);
  			//return alert(e_str[CMM_USER_PWD_FORMAT_ERR]);
  		}
  		if (value.indexOf(" ") != -1) {
  		
  			return inputError($confirm, e_str[CMM_USER_PWD_FORMAT_ERR], isMobile);
  		}
  		if(/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]/.test(value) == false)
  		{
  			return inputError($confirm, e_str[CMM_USER_PWD_FORMAT_ERR], isMobile);
  		}
  
          if (confirmValue != value) {
              inputError($confirm, $.tpLang.login.tipsTextConfirm, isMobile);
              return;
          }
  		
          if(isMobile != true)
          {
              doSetPassword(value, function() {
                  //do login after set password
                  var action = "1";
                  var isMobile = false;
                  var user = "user";
  
                  getAuthParm();
                  
                  if(INCLUDE_LOGIN_GDPR_ENCRYPT) {
  
                      if (!INCLUDE_LOGIN_USERNAME && INCLUDE_USER_RESTRICTION) {
                          user = adminType == "admin" ? 'admin' : 'user';
                      }
  
                      $.Iencryptor.setSeq($.seq);
                      $.Iencryptor.setRSAKey($.nn, $.ee);
                      $.Iencryptor.setHash(user, value);
                      $.Iencryptor.genAESKey();
  
                      user = $.Base64Encoding(user);
                      doLogin(user, value, action, isMobile, (isMobile ? $('#ph-login-btn') : $('#pc-login-btn')));
  
                  } else {
                      auth = rsaEncrypt($.Base64Encoding(value), n, e);
                      if (INCLUDE_LOGIN_USERNAME) {
                          name = rsaEncrypt($.Base64Encoding(user), n, e);
                      } else {
                          name = rsaEncrypt($.Base64Encoding('admin'), n, e);
                      }
                      doLogin(name, auth, action, isMobile, (isMobile ? $('#ph-login-btn') : $('#pc-login-btn')));
                  }
              });
          }
          
      };
  
      function checkPwd(isMobile) {
          var $password = $("#pc-setPwd-new");
          var $pwdCheck = $('#pwdCheck');
          var value = $password.val();
  
          if (isMobile === true) {
              $password = $("#ph-setPwd-new");
              $pwdCheck = $('#passwordLevelP');
              value = $password.val();
          }
  
          var asciiWithoutSpace = /^(?=[^ ]+$)[\x21-\x7f]+$/;
          var upperRe = /[A-Z]/;
          var lowerRe = /[a-z]/;
          var otherRe = /(.[^a-zA-Z0-9])/;
          var digitRe = /\d/;
  
          var hasUpper = 0;
          var hasLower = 0;
          var hasDigit = 0;
          var hasOther = 0;
          var largeLength = 0;
  
          var level = 0;
  
          if (asciiWithoutSpace.test(value) === false) {
              $pwdCheck.removeClass('level1 level2 level3');
              if (value == '') {
                  inputError($password, $.tpLang.login.tipsText, isMobile);
              } else {
                  inputError($password, $.tpLang.login.tipsTextAscii, isMobile);
              }
              pwdCheckOK = false;
              return;
          } else {
              inputError($password, false, isMobile);
              if (upperRe.test(value)) {
                  hasUpper = 1;
              } else {
                  hasUpper = 0;
              }
  
              if (lowerRe.test(value)) {
                  hasLower = 1;
              } else {
                  hasLower = 0;
              }
  
              if (digitRe.test(value)) {
                  hasDigit = 1;
              } else {
                  hasDigit = 0;
              }
  
              if (otherRe.test(value)) {
                  hasOther = 1;
              } else {
                  hasOther = 0;
              }
  
              if (value.length > 10) {
                  largeLength = 1;
              } else {
                  largeLength = 0;
              }
  
              level = hasUpper + hasLower + hasDigit + hasOther;
              if (level >= 2) {
                  level += largeLength;
              }
              if (level <= 1 || value.length <=5) {
                  $pwdCheck.removeClass('level2 level3').addClass('level1');
              } else if (level == 2 || level == 3) {
                  $pwdCheck.removeClass('level1 level3').addClass('level2');
              } else if (level >= 4) {
                  $pwdCheck.removeClass('level2 level1').addClass('level3');
              }
              pwdCheckOK = true;
          }
      }
  
      function initSetPwd(isMobile) {
          $('#pc-login').addClass('nd');
          $('#pc-cloud').addClass('nd');
          $('#pc-setPwd').removeClass('nd');
  
          buttonError($('#pc-setPwd-btn'), "<span class='red'>" + $.tpLang.login.notePart1 + ":</span> <br />" + $.tpLang.login.notePart2);
          //phone
          $('#ph-setPwd').removeClass('nd');
          $('#ph-login').addClass('nd');
          $('#ph-setPwd-note').show().find('.errTextP').html("<span class='red'>" + $.tpLang.login.notePart1 + ":</span> <br />" + $.tpLang.login.notePart2);
  
      }
  
      /*==========================================
       * code for login
       ==========================================*/
      $('#pc-login-password').on('focus', function () {
          if($(this).val() === '') {
              $(this).attr('placeholder', '');
          }
          if (INCLUDE_LOGIN_USERNAME && $('#pc-login-user').val() == '') {
              inputError($('#pc-login-user'), $.tpLang.login.tipsText);
          }
      });
      $('#pc-login-password').blur(function() {
          if($(this).val() === '') {
              $(this).attr('placeholder', $.tpLang.login.password);
          }
      })
      $('#pc-login-password').next('input').on('focus', function () {
          if($(this).val() === '') {
              $(this).attr('placeholder', '');
          }
          if (INCLUDE_LOGIN_USERNAME && $('#pc-login-user').val() == '') {
              inputError($('#pc-login-user'), $.tpLang.login.tipsText);
          }
      });
      $('#pc-login-password').next('input').blur(function() {
          if($(this).val() === '') {
              $(this).attr('placeholder', $.tpLang.login.password);
          }
      })
      function tpAlert(str, ok, no, replaceStr, okStr) {
          $('#mask').show();
          var container = $('#alert-container');
          if (isMF) {
              container.addClass('ph');
          } else {
              container.removeClass('ph');
          }
          container.show()
                  .find('.grid-warning-msg span.text').html(str);
  		$('#confirm-no').addClass('nd');
          $('#alert-container .msg-close').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (no) {
                  no();
              }
          });
          $('#confirm-yes').html('<span>' + (okStr || $.tpLang.m_str.ok) + '</span>').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (ok) {
                  ok();
              }
          });
      };
      $('#pc-login-btn').on('click', function () {
  		verify();
  
  		setTimeout(function(){
  
          if (isVerified == false) {
  
              $('#pc-login-vcode').focus();
  
  			alert("The input of verification is error, please check and input again!");
  			PCSubWin(isMF);
  
              return;
  
          }
  
          loginSubmit();},500);
      });
  
  //for phone
      $('#ph-login-password').on('focus', function () {
          if (INCLUDE_LOGIN_USERNAME && $('#ph-login-user').val() == '') {
              inputError($('#pc-login-user'), $.tpLang.login.tipsText, true);
          }
      });
  
      $('#ph-login-btn').on('click', function () {
          loginSubmit(true);
      });
  
      function showWelcome() {
          $('#welcome').removeClass('nd');
          $('#ph-div').addClass('nd');
          var icons = ['usb', 'wireless', 'internet', 'guest', 'device', 'phone'];
          for (var i = 0; i < icons.length; i++) {
              (function() {
                  var id = 'wel-'+icons[i];
                  var name = icons[i]+'-show';
                  setTimeout(function() {
                      $('#' + id).addClass(name);
                  }, 100*(i+1));
              })();
          }
          setTimeout(function() {
              $('#wel-logo').addClass('logo-show');
          }, 1500);
          setTimeout(function() {
              showLoginMobile();
          }, 3500);
      }
  
      function showLoginMobile() {
          $('#welcome').addClass('nd');
          $('#ph-div').removeClass('nd');
      }
  
      function initLogin(isMobile) {
          $('#pc-div').removeClass('nd');
          if (isCloudBind){
              $('#pc-login').addClass('nd');
              $('#pc-cloud').removeClass('nd');
          } else {
              $('#pc-login').removeClass('nd');
              $('#pc-cloud').addClass('nd');
          }
          $('#pc-setPwd').addClass('nd');
  
          $('#ph-login').removeClass('nd');
          $('#ph-setPwd').addClass('nd');
  
          //开机动画
          if (isMobile == true && authTimes == 0) {
              showWelcome();
          } else {
              showLoginMobile();
          }
  
          if (INCLUDE_LOGIN_USERNAME) {
              $('#pc-login-user-div').removeClass('nd');
              $('#ph-login-user-div').removeClass('nd');
          }
          if (authTimes > 0) {
              var text = $.tpLang.login.errorText;
              if (INCLUDE_LOGIN_USERNAME) {
                  text = $.tpLang.login.errorText2;
              }
              buttonError($('#pc-login-btn'), text);
              inputError($('#ph-login-password'), text, true);
              if (INCLUDE_LOGIN_USERNAME) {
                  $('#ph-login-password').removeClass('err');
              }
  
          }
          if (authTimes >= 5) {
              isLocked = true;
              lockWeb(true);
              var date = new Date();
              var time = date.getTime();
              var count = 60 - forbidTime;
              buttonError($('#pc-login-btn'), timesText.replace('$', count), true);
              inputError($('#ph-login-password'), timesText.replace('$', count), true);
              if (INCLUDE_LOGIN_USERNAME) {
                  $('#ph-login-password').removeClass('err');
              }
              setTimeout(function () {
                  if (count < 1) {
                      buttonError($('#pc-login-btn'), false);
                      inputError($('#ph-login-password'), false, true);
                      isLocked = false;
                      lockWeb(false);
                      if (INCLUDE_LOGIN_USERNAME) {
                          if (isMF) {
                              $('#ph-login-user').focus();
                          } else {
                              $('#pc-login-user').focus();
                          }
                      } else {
                          if (isMF) {
                              $('#ph-login-password').focus();
                          } else {
                              $('#pc-login-password').focus();
                          }
                      }
  
                      window.location.reload();
                      return;
                  }
                  date = new Date();
                  count = 60 - forbidTime - Math.round((date.getTime() - time) / 1000);
                  buttonError($('#pc-login-btn'), timesText.replace('$', count), true);
                  inputError($('#ph-login-password'), timesText.replace('$', count), true);
                  if (INCLUDE_LOGIN_USERNAME) {
                      $('#ph-login-password').removeClass('err');
                  }
                  window.setTimeout(arguments.callee, 1000);
              }, 1000);
          } else {
              if (INCLUDE_LOGIN_USERNAME) {
                  if (isMF) {
                      $('#ph-login-user').focus();
                  } else {
                      $('#pc-login-user').focus();
                  }
              } else {
                  if (isMF) {
  //                    $('#ph-login-password').focus();
                  } else {
                      $('#pc-login-password').focus();
                  }
              }
          }
      }
  
      var loginSubmit = function (isMobile) {
          if (isLocked == true) {
              return;
          }
  
          var auth;
          var name;
          var action = "1";
          var $password = $("#pc-login-password");
          var $user = $("#pc-login-user");
  
          getAuthParm();
  
          if (isMobile === true) {
              $password = $("#ph-login-password");
              $user = $("#ph-login-user");
          }
  
          var pwd = $password.val();
          var user = $user.val();
  
          if (INCLUDE_LOGIN_USERNAME && user == '') {
              inputError($user, $.tpLang.login.tipsText, isMobile);
              return;
          }
          if (pwd == "") {
              inputError($password, $.tpLang.login.tipsText, isMobile);
              return;
          }
  	
          if(INCLUDE_LOGIN_GDPR_ENCRYPT)
          {
              if (!INCLUDE_LOGIN_USERNAME && INCLUDE_USER_RESTRICTION) {
                  user = adminType == "admin" ? 'admin' : 'user';
              }
              $.Iencryptor.setSeq($.seq);
              $.Iencryptor.setRSAKey($.nn, $.ee);
              $.Iencryptor.setHash(user, pwd);
              $.Iencryptor.genAESKey();
  
              user = $.Base64Encoding(user);
              doLogin(user, pwd, action, isMobile, (isMobile ? $('#ph-login-btn') : $('#pc-login-btn')));
  
          } else {
              auth = rsaEncrypt($.Base64Encoding(pwd), n, e);
              if (INCLUDE_LOGIN_USERNAME) {
                  name = rsaEncrypt($.Base64Encoding(user), n, e);
              } else {
                  name = rsaEncrypt($.Base64Encoding('admin'), n, e);
              }
  
              if (isMobile) {
                  action = 3;
              }
  
              doLogin(name, auth, action, isMobile, (isMobile ? $('#ph-login-btn') : $('#pc-login-btn')));
  
          }
      };
  
      /**
       * 普通登录，云登录，手机登录共用的接口
       * @param name {string} 用户名
       * @param auth {string} 密码
       * @param action {number} 操作，这里只会出现1:普通登录和云登录，3:手机登录
       * @param isMobile {boolean} 手机UI标志位，用于addLoading
       * @param btn {jQuery object} 当前登录的牛，用于addLoading
       */
      function doLogin(name, auth, action, isMobile, btn,userInfo) {
  
  
          var xmlHttpObj = getHttpObject(function () {
              if (!isMobile) {
                  $.removeLoading();
              }
              if (INCLUDE_USER_RESTRICTION) {
                  window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
              } else {
                  window.location.href = window.location.protocol + "//" + window.location.host;
              }
          });
          if (INCLUDE_LOGIN_GDPR_ENCRYPT)
          {
              var tmpcount = {};
              tmpcount.UserName=name;
              tmpcount.Passwd=$.Base64Encoding(auth);
  			if(userInfo!=undefined)
  			{
  				tmpcount.cloudUserName=$.Base64Encoding(userInfo.username);
  				tmpcount.Token=userInfo.token;
  				tmpcount.LoginStatus="0";
  			}
  			tmpcount.Action = action;
              tmpcount.stack="0,0,0,0,0,0";
              tmpcount.pstack="0,0,0,0,0,0";
          }
          else{
  
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/login?UserName=" + name + "&Passwd=" + auth + "&Action=" + action + "&LoginStatus=0", true);
          }
          getBusy(function(status) {
              if (status.isLogined == 0) {
                  //没人登录则直接登录
                  if (!isMobile) {
                      $.addLoading(btn);
                  } else {
                      $.showCover();
                  }
  
                  if (INCLUDE_LOGIN_GDPR_ENCRYPT)
                  {
                      $.dm.cgi({
                          oid: '/cgi/login',
                          data: tmpcount,
                          callback: {
                              success: function (data) {
                                  $.rebootRemoveLoading();
                                  $.newencryptorManager.recordEncryptor();
                                  if (INCLUDE_USER_RESTRICTION) {
                                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                  } else {
                                      window.location.href = window.location.protocol + "//" + window.location.host;
                                  }
                              },
                              fail: function (data) {
                                  if (INCLUDE_USER_RESTRICTION) {
                                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                  } else {
                                      window.location.href = window.location.protocol + "//" + window.location.host;
                                  }
                              }
                          }
                      });
                  }
                  else
                  {
                      xmlHttpObj.send(null);
                  }
              } else {
                  //弹出提示说已经有人登录是不是要强制登录
                  tpConfirm($.tpLang.login.forceLogout, function () {
                      if (!isMobile) {
                          $.addLoading(btn);
                      } else {
                          $.showCover();
                      }
  
                      if (status.isBusy == 1) {
                          var delay = 1000;
                          var count = 0;
                          var timesTotal = 2;
                          var ask = function() {
                              getBusy(function(satus) {
                                  if (status.isBusy == 0 || count >= timesTotal) {
                                      //空闲或轮询次数到达最大次数就直接登录
                                      if (INCLUDE_LOGIN_GDPR_ENCRYPT)
                                      {
                                          $.dm.cgi({
                                              oid: '/cgi/login',
                                              data: tmpcount,
                                              callback: {
                                                  success: function (data) {
                                                      $.rebootRemoveLoading();
                                                      $.newencryptorManager.recordEncryptor();
                                                      if (INCLUDE_USER_RESTRICTION) {
                                                          window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                                      } else {
                                                          window.location.href = window.location.protocol + "//" + window.location.host;
                                                      }
                                                  },
                                                  fail: function (data) {
                                                      if (INCLUDE_USER_RESTRICTION) {
                                                          window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                                      } else {
                                                          window.location.href = window.location.protocol + "//" + window.location.host;
                                                      }
                                                  }
                                              }
                                          });
                                      }
                                      else
                                      {
                                          xmlHttpObj.send(null);
                                      }
                                  } else {
                                      count++;
                                      //轮询次数未到最大次数，进入递归
                                      setTimeout(ask, delay);
                                  }
                              });
                          };
                          setTimeout(ask, delay);
                      } else {
                          if (INCLUDE_LOGIN_GDPR_ENCRYPT)
                          {
                              $.dm.cgi({
                                  oid: '/cgi/login',
                                  data: tmpcount,
                                  callback: {
                                      success: function (data) {
                                          $.rebootRemoveLoading();
                                          $.newencryptorManager.recordEncryptor();	
                                          if (INCLUDE_USER_RESTRICTION) {
                                              window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                          } else {
                                              window.location.href = window.location.protocol + "//" + window.location.host;
                                          }
                                      },
                                      fail: function (data) {
                                          if (INCLUDE_USER_RESTRICTION) {
                                              window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                          } else {
                                              window.location.href = window.location.protocol + "//" + window.location.host;
                                          }
                                      }
                                  }
                              });
                          }
                          else
                          {
                              xmlHttpObj.send(null);
                          }
                      }
                  }, function () {
                      if (!isMobile) {
                          //$.removeLoading();
                      }
                  }, null, $.tpLang.login.login, $.tpLang.m_str.cancel);
              }
          });
      }
  
      /**
       * 确认框
       * @param str {string} 提示文本
       * @param ok {function} 确认回调
       * @param no {function} 取消回调
       * @param replaceStr {string} 保留未用
       * @param okStr {string} 确认按钮的文本
       * @param cancelStr {string} 取消按钮的文本
       */
      function tpConfirm(str, ok, no, replaceStr, okStr, cancelStr) {
          $('#mask').show();
          var container = $('#alert-container');
          if (isMF) {
              container.addClass('ph');
          } else {
              container.removeClass('ph');
          }
          container.show()
                  .find('.grid-warning-msg span.text').html(str);
          $('#confirm-no').html('<span>' + (cancelStr || $.tpLang.m_str.cancel) + '</span>').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (no) {
                  no();
              }
          });
  
          $('#alert-container .msg-close').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (no) {
                  no();
              }
          });
          $('#confirm-yes').html('<span>' + (okStr || $.tpLang.m_str.ok) + '</span>').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (ok) {
                  ok();
              }
          });
  
      }
  	
  	function getEwebUrl(module) {
          var xmlHttpObj;
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  return;
  
              } else {
                  if (INCLUDE_USER_RESTRICTION) {
                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                  } else {
                      window.location.href = window.location.protocol + "//" + window.location.host;
                  }
              }
          });
  	
          //bAsync must be set False to waiting entire response is received.
          xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getEwebUrl", false);
          xmlHttpObj.send(null);
          eval(xmlHttpObj.responseText);
          $.cloudOrigin = EwebURL;
          if(!$.cloudOrigin){
              $(window).trigger("ev_watingTimeout");
          }else{
             $.setIframeSrc(module, true);
          }
      }
  
      /*==========================================
       * code for pc cloud
       ==========================================*/
      var token;
  	
      $('#cloud-bind-btn').on('click', function () {
          cloudSubmit();
      });
      $('#pc-cloud-btn').on('click', function () {
          cloudSubmit();
      });
      $('#pc-cloud-user').tpInput({
          placeholder: $.tpLang.login.email
      });
      $('#pc-cloud-password').on('focus', function () {
          if ($('#pc-cloud-user').val() == '') {
              inputError($('#pc-cloud-user'), $.tpLang.login.tipsText);
          }
      }).tpInput({
          placeholder: $.tpLang.login.password
      });
  
      $('#pc-cloud-forgetPwd').html($.tpLang.login.forgetPwd).on("click", function (e) {
          e.preventDefault();
          onReceive({data: {eType: "ev_goto", url: "findBackPassword"}, source: null, origin: "_self"});
      });
  
  	// switch local login and cloud login part
      if (INCLUDE_CLOUD) {
          var loginSwitchBtn = $("<div class=\"login-switch-btn\"><span>" + $.tpLang.login.LOGIN_WITH_TPLINK_ID + "</span></div><div class=\"login-switch-note nd\">"+$.tpLang.login.LOGIN_SWITCH_NOTE+"</div>");
          $('#pc-login-submit').append(loginSwitchBtn);
      }
  	
  	$("span#login-bind-note").html($.tpLang.login.BIND_NOTE);
  	$("#bound-error .note").text($.tpLang.login.BOUND_ERROR_NOTE);
  	$("#bound-error .switch-btn").text($.tpLang.login.LOGIN_WITH_ROUTER_PASSWORD);
  	$("#bound-error .switch-btn").click(function(){
  		$("#bound-error").hide();
  		initLogin(isPhoneUI);
  	});
  	
      $('.login-switch-btn').on("click", function (e) {
          if (isLocked == true) {
              return;
          }
          $.addLoading();
  		if ($.nn==undefined){
              getAuthParm();
          }
  		isCloudBind = false;
          $.checkCloudConn(function(){
              initCloud();
                  e.preventDefault();
                  $(".login-switch-note").hide();
                  onReceive({data: {eType: "ev_goto", url: "login"}, source: null, origin: "_self"});
                  $.rebootRemoveLoading();
              }, function(){
                  $(".login-switch-note").show();
                  $.rebootRemoveLoading();
          });
      });
  	
      function getBindStatus(username,token) {
          var xmlHttpObj;
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  return;
  
              } else {
                  window.location.href= window.location.protocol + "//" + window.location.host;
              }
          });
          //bAsync must be set False to waiting entire response is received.
          if(INCLUDE_LOGIN_GDPR_ENCRYPT) {
              var info;
              var str = username+"&"+token;
              $.Iencryptor.setHash(username, token);
              $.Iencryptor.genAESKey();
              info = $.Iencryptor.AESEncrypt(str, 1);
              $.newencryptorManager.recordEncryptor();
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getBindStatus?data=" + encodeURIComponent(info.data) +"&sign=" + info.sign, false);
          } else {
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getBindStatus?cloudUserName="+$.Base64Encoding(username)+"&Token="+token, false);
          }
          xmlHttpObj.send(null);
        
services.body_hash_sha1: sha1:5733dd5403a8b9c98f1cb708161451ceb5148665
services.supported_versions: HTTP/1.1
services.protocol: HTTP
services.transport_protocol: TCP
services.scan_time: 2025-07-28T04:53:32.400740
services.banner: HTTP/1.1 200 OK
  Content-Type: text/html; charset=utf-8
  X-Frame-Options: SAMEORIGIN
  Content-Security-Policy: frame-ancestors 'none'
  Content-Length: 83512
  X-Frame-Options: SAMEORIGIN
  Set-Cookie: JSESSIONID=deleted; Expires=Thu, 01 Jan 1970 00:00:01 GMT; Path=/; HttpOnly
  Connection: keep-alive
  
services.version_selected: TLSv1_3
services.cipher_selected: TLS_AES_128_GCM_SHA256
services.ja4s: t130200_1301_a56c5b993250
services.version: TLSv1_3
services.ja4s: t130200_1301_a56c5b993250
services.version: TLSv1_2
services.ja4s: t120200_c02f_344b4dce5a52
services.names: tplinkwifi.net
services.issuer_dn: CN=TP-LINK SOHO Router CA, O=EX820v, OU=20362690B28C8F641B6140EC46C556855F29
services.common_name: TP-LINK SOHO Router CA
services.organization: EX820v
services.organizational_unit: 20362690B28C8F641B6140EC46C556855F29
services.subject_dn: CN=tplinkwifi.net
services.common_name: tplinkwifi.net
services.value: jquery
services.value: login-page
services.path: /
services.endpoint_type: HTTP
services.scan_time: 2025-07-28T04:53:32.400740
services.uri: https://125.24.73.63/
services.protocol: HTTP/1.1
services.status_reason: OK
services.key: X-Frame-Options
services.headers: SAMEORIGIN SAMEORIGIN
services.key: Content-Security-Policy
services.headers: frame-ancestors 'none'
services.key: Content-Type
services.headers: text/html; charset=utf-8
services.key: Set-Cookie
services.headers: JSESSIONID=deleted; Expires=Thu, 01 Jan 1970 00:00:01 GMT; Path=/; HttpOnly
services.key: Connection
services.headers: keep-alive
services.key: Content-Length
services.headers: 83512
services.html_tags: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
services.body: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  
  <head>
      <link rel="shortcut icon" type="image/x-icon" href="../img/favicon.ico"/>
      <link rel="stylesheet" href="../css/main.css"/>
      <link rel="stylesheet" href="../css/login.css"/>
      <link rel="stylesheet" href="../css/jquery.tpInput.css"/>
  	<link rel="stylesheet" href="../css/jquery.tpPassword.css"/>
      <script src="../js/jquery-1.8.3.min.js" type="text/javascript"></script>
      <script src="../js/lib.js" type="text/javascript"></script>
      <script type="text/javascript" src="../locale/language.js"></script>
      <script type="text/javascript" src="../js/oid_str.js"></script>
      <script type="text/javascript" src="../js/locale.js"></script>
      <script type="text/javascript" src="../js/encrypt.js"></script>
      <script type="text/javascript" src="../js/jquery.tpInput.js"></script>
  	<script type="text/javascript" src="../js/jquery.tpPassword.js"></script>
      <script type="text/javascript" src="../js/oid_str.js"></script>
      <script src="../js/cryptoJS.min.js" type="text/javascript"></script>
      <script src="../js/tpEncrypt.js" type="text/javascript"></script>
      <script src="../js/gdprProxy.js" type="text/javascript"></script>
  	    <style type="text/css">
          #pc-login-vcode {
              padding: 0 0 0 30px;
              display: inline-block;
              border: 1px solid #ccc;
              border-radius: 4px;
              outline-color: #ffffff;
              -webkit-box-sizing: border-box;
              -moz-box-sizing: border-box;
              box-sizing: border-box;
              width: 120px;
              height: 32px;
              line-height: 32px;
              font-size: 12px;
          }
          #pc-refresh-code {
              line-height: 32px;
              text-decoration: underline;
              color: #4acbd6;
              white-space: nowrap;
          }
          #pc-verify-btn, #pc-clear-btn {
              /*border: none;*/
              border-radius: 5px;
              /*color: #fff;*/
              height: 30px;
              /*line-height: 32px;*/
              width: 60px;
              /*background-color: #4acbd6;*/
              /*min-width: 90px;*/
              /*padding: 8px 6px 9px;*/
              cursor: pointer;
              box-sizing: border-box;
          }
          .button-verify-text {
              text-align: center;
              font-size: 14px;
              color: rgb(83, 74, 74);
          }
          #pc-vode {
              position: relative;
              display: inline-block;
          }
      </style>
      <!--[if lte IE 8]>
      <link href="./css/ie.css" rel="stylesheet" type="text/css"/>
      <style type="text/css">
          .input-err-container .input-err-delta, #pc-scroll div.widget-error-tips span.widget-error-tips-delta {
              top: 4px;
              left: 96px;
          }
  
          .input-container .input-err-container, .button-error-tips {
              left: -11px;
              top: 30px;
          }
  
          .input-container .input-wrapper {
              background: url("../img/ie.png") no-repeat -250px -226px;
              border: none;
              width: 186px;
              height: 33px;
          }
  
          .input-container.err .input-wrapper {
              background-position: -219px -173px;
              border: none;
          }
  
          .input-container.focus .input-wrapper {
              background-position: 1px -225px;
              border: none;
          }
  
          button.button-button {
              background: url("../img/ie.png") no-repeat -255px -32px;
          }
  
          button.button-button:hover {
              background: url("../img/ie.png") no-repeat 0px -32px;
          }
  
          #pc-scroll div.widget-error-tips div.widget-error-tips-wrap, .input-err-container .input-err-content {
              border: 0;
              box-shadow: none;
          }
  
          .shadow-top {
              background: url("../img/ie-01.png") repeat-x 0 -5px;
              top: -13px;
              left: 0;
              height: 13px;
              margin: 0 17px 0 17px;
          }
  
          .shadow-bot {
              background: url("../img/ie-01.png") repeat-x center bottom;
              bottom: -13px;
              left: 0;
              height: 13px;
              margin: 0 17px 0 17px;
          }
  
          .shadow-top-left, .shadow-top-right, .shadow-bot-left, .shadow-bot-right {
              position: absolute;
              width: 17px;
              height: 11px;
              background: url(../img/ie-06.png) no-repeat 0px -56px;
          }
  
          .shadow-top-left {
              background-position: 0px -56px;
              left: 4px;
              top: 4px;
          }
  
          .shadow-top-right {
              background-position: 0px -38px;
              right: 0;
              top: 3px;
          }
  
          .shadow-bot-left {
              background-position: 0px -76px;
              left: 3px;
              bottom: 8px;
          }
  
          .shadow-bot-right {
              background-position: 0px -95px;
              right: 0;
              bottom: 8px;
          }
  
          .shadow-left {
              padding-left: 11px;
              background: url(../img/ie-02.png) no-repeat 0px 0px;
          }
  
          .shadow-right {
              padding-right: 11px;
              background: url(../img/ie-02.png) no-repeat center right;
          }
  
      </style>
      <![endif]-->
  </head>
  
  <body>
  <div id="cover" class="nd"></div>
  <div id="mask" class="mask"></div>
  <span class="load" style="display: none">for cache</span>
  
  <div id="pc-div">
  	<div id="pc-top">
  		<div id="pc-top-container">
  		</div>
  	</div>
  	<div id="pc-scroll">
  		<div id="pc-main">
  			<div class="pc-login-content" id="pc-login">
  		            <div class="pc-login-field">
                  <img src="../img/c_internet.png" width="200px" />
              </div>
  		            <div class="pc-login-field img_div">			
                  <img src="../img/TP-logo.png" width="60px" style="margin: 0px -120px 0px 0px" />
  				</div>
  				<div id="pc-login-main">
  					<div class="pc-login-field nd" id="pc-login-user-div">
  						<div class="pc-inputarea">
  							<label class="pc-login-username-label">
  								<span class="icon"></span>
  								<span class="text"></span>
  							</label>
  							<input type="text" id="pc-login-user" autocomplete="off" />
  						</div>
  					</div>
  					<div class="pc-login-field">
  						<div class="pc-inputarea">
  							<label class="pc-login-password-label">
  								<span class="icon"></span>
  							</label>
  							<input type="password" id="pc-login-password" autocomplete="off" />
  					    </div>
  
  					</div>
  
             <div class="pc-login-field">
  
                 <img id="pc-vcode-img" src="../img/codes/code.gif">
  
                  <div>
  
                      <span>Enter the code above here:</span>
  
                  </div>
  
                  <div id="pc-vode">
  
                      <label class="pc-login-code-label">
  
                          <span class="icon" id="pc-code-label"></span>
  
                      </label>
  
                      <input type="text" id="pc-login-vcode" autocomplete="off" maxlength=7 class="tpInput" >
  
                  </div>
  
                  <div>
  
                  <span>Can't read the image ? click <a href="#" id="pc-refresh-code">here</a> to refresh</span>
  				</div>
  			</div>
  					<div id="pc-login-submit">
  						<div class="button-wrapper">
  							<button id="pc-login-btn" class="button-button" type="button">
  								<span class="text button-text">Log in</span>
  							</button>
  							<div class="button-error-tips widget-error-tips">
  								<div class="shadow-top-left"></div>
  								<div class="shadow-top"></div>
  								<div class="shadow-top-right"></div>
  								<div class="shadow-left">
  									<div class="shadow-right">
  										<span class="widget-error-tips-delta"></span>
  
  										<div class="widget-error-tips-wrap">
  											<div class="content error-tips-content">
  												<span id="errorContent"></span>
  											</div>
  										</div>
  									</div>
  								</div>
  								<div class="shadow-bot-left"></div>
  								<div class="shadow-bot"></div>
  								<div class="shadow-bot-right"></div>
  							</div>
  						</div>
  					</div>
  				</div>
  			</div>
  
  			<div class="pc-login-content nd" id="pc-setPwd">
  				<div class="pc-login-field">
  					<div class="pc-inputarea">
  						<label class="pc-login-password-label">
  							<span class="icon"></span>
  						</label>
  						<input type="password" id="pc-setPwd-new" autocomplete="off" />
  					</div>
  					<div style='text-align:left'> 
  						<li class="T_haveSpace nd" id="t_haveSpace" style='color:red'> 
  							<span style='color:grey' id="t_pwMustNoSpace"> Must contain no space(s)</span> 
  						</li>
  						<li class="T_passwordLen nd" id="t_passLen" style='color:red'> 
  							<span style='color:grey' id="t_pwMustLength"> Must be 6-32 character long</span> 
  						</li>
  						<li class="T_passwordType nd" id="t_passType" style='color:red'> 
  							<span style='color:grey' id="t_pwMust2Type"> Must contain two types of characters</span> 
  						</li> 
  					</div>
  				</div>
  				<div id="pwdCheck" class="secLevel">
  					<span id="pwdCheck-low" class="level1 ori">Low</span>
  					<span id="pwdCheck-middle" class="level2 ori">Middle</span>
  					<span id="pwdCheck-high" class="level3 ori">High</span>
  				</div>
  				<div class="pc-login-field">
  					<div class="pc-inputarea">
  						<label class="pc-login-password-label">
  							<span class="icon"></span>
  						</label>
  						<input type="password" id="pc-setPwd-confirm" autocomplete="off" />
  					</div>
  				</div>
  
  				<div >
  					<center>
  						<span style='color:red' class="T_passwordFormat nd" id="t_passFormat">The password must consist of letters numbers and special characters, <br> including at least two of types. it's length must be 6 to 32 and It cannot contain spaces</span>
  					</center>
  				</div>
  
  				<div>
  					<div class="button-wrapper">
  						<button id="pc-setPwd-btn" class="button-button" type="button">
  							<span class="text button-text">Log in</span>
  						</button>
  						<div class="button-error-tips widget-error-tips">
  							<div class="shadow-top-left"></div>
  							<div class="shadow-top"></div>
  							<div class="shadow-top-right"></div>
  							<div class="shadow-left">
  								<div class="shadow-right">
  									<span class="widget-error-tips-delta"></span>
  
  									<div class="widget-error-tips-wrap">
  										<div class="content error-tips-content">
  											<span id="errorContent"></span>
  										</div>
  									</div>
  								</div>
  							</div>
  							<div class="shadow-bot-left"></div>
  							<div class="shadow-bot"></div>
  							<div class="shadow-bot-right"></div>
  						</div>
  					</div>
  				</div>
  			</div>
  			<div id="pc-cloud" class="nd">
  				<div id="cloud-bind-main" class="pc-login-content nd" >
  					<div id="login-bind-note-cnt">
  						<span class="text" id="login-bind-note"></span>
  					</div>
  					<div class="login-field">
  						<div id="cloud-bind-user-div" class="pc-login-field nd" >
  							<div class="pc-inputarea">
  								<label class="pc-login-username-label">
  									<span class="icon"></span>
  									<span class="text"></span>
  								</label>
  								<input type="text" id="cloud-bind-user" autocomplete="off" />
  							</div>
  						</div>
  					</div>
  					<div class="pc-login-field">
  						<div class="pc-inputarea">
  							<label class="pc-login-password-label">
  								<span class="icon"></span>
  								<span class="text"></span>
  							</label>
  							<input type="password" id="cloud-bind-password" autocomplete="off" />
  						</div>
  					</div>
  					<div>
  						<div class="button-wrapper">
  							<button id="cloud-bind-btn" class="button-button" type="button">
  								<span class="text button-text">Bind</span>
  							</button>
  							<div class="button-error-tips widget-error-tips">
  								<div class="shadow-top-left"></div>
  								<div class="shadow-top"></div>
  								<div class="shadow-top-right"></div>
  								<div class="shadow-left">
  									<div class="shadow-right">
  										<span class="widget-error-tips-delta"></span>
  
  										<div class="widget-error-tips-wrap">
  											<div class="content error-tips-content">
  												<span class="errorContent"></span>
  											</div>
  										</div>
  									</div>
  								</div>
  								<div class="shadow-bot-left"></div>
  								<div class="shadow-bot"></div>
  								<div class="shadow-bot-right"></div>
  							</div>
  						</div>
  					</div>
  				</div>
  				<div id="bound-error" class="nd">
  					<div class="note"></div>
  					<div class="switch-btn"></div>
  				</div>
  				<iframe frameborder="0" id="cloud-login" name="cloud-login" scrolling="no" class="nd"></iframe>
  			</div>
  		<div class="pc-login-field">
          <img src="../img/cat_note.png" style="MARGIN: -30px -10px 0px -10px" width="400">
          </div>
  		</div>
  		<div id="pc-bottomContainer">
  			<div id="pc-bottom">
  				<span id="pc-bot-productName"></span>
  				<span id="pc-bot-modelDesc"></span>
  			</div>
  			<div class="pc-bottom-background"></div>
  		</div>
  	</div>
  
  </div>
  <div id="alert-container"
       class="alert-container widget-container msg-container grid-popup-msg msg-container-center">
      <div class="msg-container-wrapper">
          <div class="position-top-left"></div>
          <div class="position-top-center"></div>
          <div class="position-top-right"></div>
          <div class="position-center-left">
              <div class="position-center-right">
                  <div class="msg-wrap"><a class="widget-close msg-close" href="javascript:void(0);"></a>
  
                      <div class="msg-content-wrap">
                          <div class="widget-content msg-content-container">
                              <div class="grid-warning-msg">
  								<span class="icon"></span>
  								<span class="text">The device will reboot. Are you sure to continue?</span>
                              </div>
                          </div>
                      </div>
                  </div>
                  <div class="msg-btn-container">
                      <div class="msg-btn-wrap">
                          <div class="button-container in-line">
                              <button type="button" class="button-button green pure-button btn-msg btn-msg-no btn-confirm"
                                      id="confirm-no">
                                  <span>No</span>
  							</button>
                          </div>
                          <div class="button-container in-line">
                              <button type="button" class="button-button green pure-button btn-msg btn-msg-ok btn-confirm"
                                      id="confirm-yes">
                                  <span>Yes</span>
  							</button>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
          <div class="position-bottom-left"></div>
          <div class="position-bottom-center"></div>
          <div class="position-bottom-right"></div>
      </div>
  </div>
  <div id="welcome" class="nd">
      <div class="wel-top">
          <div class="icon-router sprite o-network-router"></div>
          <div id="wel-usb" class="sprite icon icon-usb e-welcome-usb"></div>
          <div id="wel-wireless" class="sprite icon icon-wireless e-welcome-wireless"></div>
          <div id="wel-internet" class="sprite icon icon-internet e-welcome-internet"></div>
          <div id="wel-guest" class="sprite icon icon-guest e-welcome-guest"></div>
          <div id="wel-device" class="sprite icon icon-device e-welcome-device"></div>
          <div id="wel-phone" class="sprite icon icon-phone e-welcome-phone"></div>
      </div>
      <div id="wel-logo" class="sprite n-logoPhone"></div>
      <div class="company">TP-Link Corporation Limited<br>All rights reserved</div>
  </div>
  <div id="ph-div" style="display: none;">
      <div class="ph-header">
          <div class="ph-logo">
          </div>
          <!--<div style="text-align: center"><span id="ph-productName" class="ph-productName"></span></div>-->
      </div>
      <div class="ph-form">
          <form id="ph-setPwd">
              <div class="form-line">
                  <span class="sprite c-login-password"></span>
                  <input type="password" id="ph-setPwd-new" class="form-inputText" placeholder="New Password"
                         autocomplete="off" />
  
                  <div class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP">errTips</p>
                  </div>
                  <div id="passwordLevelP" class="password-level">
                      <span id="pwdCheckP-low" class="low">Low</span>
                      <span id="pwdCheckP-middle" class="middle">Middle</span>
                      <span id="pwdCheckP-high" class="high">High</span>
                  </div>
              </div>
  
              <div class="mt11 form-line">
                  <span class="sprite c-login-password"></span>
                  <input type="password" id="ph-setPwd-confirm" class="form-inputText" placeholder="Confirm Password"
                         autocomplete="off" />
  
                  <div class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP">errTips</p>
                  </div>
              </div>
  
              <div class="form-line mt20">
                  <input type="button" id="ph-setPwd-btn" class="form-lgBt" value="Save" />
  
                  <div id="ph-setPwd-note" class="noteDivP mt11">
                      <p class="errTextP">errTips</p>
                  </div>
              </div>
          </form>
          <form id="ph-login" class="nd">
              <div class="mt11 form-line nd" id="ph-login-user-div">
                  <span class="sprite c-login-account"></span>
                  <input type="password" id="ph-login-user" class="form-inputText" placeholder="Username"
                         autocomplete="off" />
  
                  <div class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP"></p>
                  </div>
              </div>
              <div class="mt11 form-line">
                  <span class="sprite c-login-password"></span>
                  <input type="password" id="ph-login-password" class="form-inputText" placeholder="Password"
                         autocomplete="off" />
  
                  <div class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP"></p>
                  </div>
              </div>
  
  
              <div class="form-line mt20">
                  <input type="button" id="ph-login-btn" class="form-lgBt" value="Login" />
  
                  <div id="ph-login-note" class="errDivP mt11 nd">
                      <span class="sprite b-error-alert"></span>
  
                      <p class="errTextP">errTips</p>
                  </div>
              </div>
          </form>
      </div>
      <div class="ph-bot">
          <a href="javascript:void(0);" id="pb-phone" class="ph-bot-phone selected"></a>
          <span>|</span>
          <a href="javascript:void(0);" id="pb-pc" class="ph-bot-pc"></a>
      </div>
  </div>
  <!-- bugfix: firefox: login in ok but can NOT access content -->
  <div id="preload"><span class="preload"></span></div> 
  <script type="text/javascript">
  $(function () {
      var INCLUDE_LOGIN_USERNAME = 0;
      if(!INCLUDE_CHGINIT_PWD || !INCLUDE_AUTH_PASSWORD)
          var INCLUDE_LOGIN_USERNAME = 1;      //控制普通登录是否有用户名
  	var isPhoneUI = false;
      var cloudLogined = false;
  	var isCloudBind = false;
      var HTTP_ERR_USER_PWD_NOT_CORRECT = 71233;
  	
      $.userInfo={};
  	localStorage.removeItem("userInfo");
      if (location.protocol != "https:") {
          //if local https function is enable and protocol is no https:, jump to https;
          if ('httpsLocalEnabled' in window && httpsLocalEnabled == '1') {
              window.location.href = "https://" + location.hostname + (('httpsLocalPort' in window && httpsLocalPort == "") ? "" : (":" + httpsLocalPort));
          }
      }
      /*=================================
       *multi language
       ===================================*/
      try {
          $.locale.load(locale_language, null, null, true);
      } catch (e) {
      }
  //set text and html with $.tpLang
  
      var timesText = $.tpLang.login.timesText;
  
      //$('#pc-cloud-password').prop('type', 'password');
  
      $('#pc-top-product').attr('href', $.su.CHAR.SUPPORT[$.locale.locale.toUpperCase()]);
      $('#pc-login-btn,#pc-cloud-btn').html('<span class="text button-text">' + $.tpLang.login.login + '</span>');
      $('#pc-setPwd-btn').html('<span class="text button-text">' + $.tpLang.login.save + '</span>');
      $('#pwdCheck-low').html($.tpLang.login.low);
      $('#pwdCheck-middle').html($.tpLang.login.middle);
      $('#pwdCheck-high').html($.tpLang.login.high);
      $('#pc-login-password').tpInput();
      $('#pc-login-user').tpInput({
          placeholder: $.tpLang.login.userName
      });
  
      $('#pc-setPwd-new').tpInput({
          placeholder: $.tpLang.login.newPassword
      });
      $('#pc-setPwd-confirm').tpInput({
          placeholder: $.tpLang.login.confirmPassword
      });
  
  	$('#pc-login-password').tpPassword({
          placeholder: $.tpLang.login.password
      });
  //phone
      $('#pb-phone').html($.tpLang.login.phone);
      $('#pb-pc').html($.tpLang.login.pc);
  
      $('#ph-setPwd-new').attr('placeholder', $.tpLang.login.newPassword);
      $('#ph-setPwd-confirm').attr('placeholder', $.tpLang.login.confirmPassword);
      $('#pwdCheckP-low').html($.tpLang.login.low);
      $('#pwdCheckP-middle').html($.tpLang.login.middle);
      $('#pwdCheckP-high').html($.tpLang.login.high);
      $('#ph-setPwd-btn').prop('value', $.tpLang.login.save);
  
      $('#ph-login-user').attr('placeholder', $.tpLang.login.userName);
      $('#ph-login-password').attr('placeholder', $.tpLang.login.password);
      $('#ph-login-btn').attr('value', $.tpLang.login.login);
      var PCSubWin = function () {
      };
      try {
          if (modelName) {
              document.title = modelName;
              $("#pc-bot-productName").html(modelName);
              $("#pc-bot-modelDesc").html(modelDesc || '');
              //for phone
              $("#ph-productName").html(modelName);
  
          }
      } catch (e) {
      }
  
      /*=============================
       *logic
       * =============================*/
      var isLocked = false;
      var isMF = 0;     //isMobileFlag
  
  
      $('body').on('keydown', function (event) {
          if (event.keyCode == 13) {
  		    verify();
  
              setTimeout(function(){
  
                  if (isVerified == false) {
  
                      $('#pc-login-vcode').focus();
  
  					tpAlert("The input of verification is error, please check and input again!",null,null,null,null);
  
                      return;
  
                  }
  
                  loginSubmit();},500);
              PCSubWin(isMF);
          }
      });
  
  
  	$('#pc-login-password').next('input').on('keydown', function (event) {
          if (event.keyCode == 13) {
              PCSubWin(isMF);
          }
      });
      $('#cloud-bind-password').next('input').on('keydown', function (event) {
          if (event.keyCode == 13) {
              PCSubWin(isMF);
          }
      });
  
      function buttonError(obj, text, notHide) {
          var tip = $(obj).next('.widget-error-tips');
          if (text === false) {
              tip.hide();
              return;
          }
          if (tip.length == 0) {
              tip = $('<div class="button-error-tips widget-error-tips"><span class="widget-error-tips-delta"></span><div class="widget-error-tips-wrap"><div class="content error-tips-content"><span id="errorContent"></span></div></div></div>').insertAfter($(obj));
          }
          tip.show().find('#errorContent').html(text);
          $('body').off('click.buttonError');
          if (notHide !== true) {
              $('body').on('click.buttonError', function () {
                  tip.hide();
                  $('body').off('click.buttonError');
              });
          }
      }
  
      var rsaEncrypt = $.rsa.encrypt;
  
  
      function lockWeb(bLock) {
          $("#pc-login-password").tpInput('disabled', bLock);
          $("#pc-login-user").tpInput('disabled', bLock);
          //for phone
          $("#ph-login-password").prop('disabled', bLock);
          $("#ph-login-user").prop('disabled', bLock);
  
          //cloud
          $("#cloud-bind-password").tpInput('disabled', bLock);
          $("#cloud-bind-user").tpInput('disabled', bLock);
  		$("#cloud-bind-password").tpInput('disabled', bLock);
      }
  
      function getHttpObject(hook) {
          var xmlHttp = null;
          try {
              xmlHttp = new XMLHttpRequest();
          } catch (e) {
              try {
                  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
              } catch (e) {
                  try {
                      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                  } catch (e) {
                      /* How to handle this error? */
                  }
              }
          }
          xmlHttp.onreadystatechange = function () {
              if (xmlHttp.readyState == 4) {
                  if (hook)
                      hook();
              }
          };
          return xmlHttp;
      }
  
      var n;
      var e;
      var s;
      var us; //userSetting
      var as; //adminSetting
      var oldVerifyCode; //record old code
  
      /**
       * get userSetting、ee、nn
       */
      function getAuthParm() {
          var xmlHttpObj;
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  return;
  
              } else {
                  if (INCLUDE_USER_RESTRICTION) {
                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                  } else {
                      window.location.href = window.location.protocol + "//" + window.location.host;
                  }
              }
          });
  
          //bAsync must be set False to waiting entire response is received.
          xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getGDPRParm", false);
          xmlHttpObj.send(null);
          eval(xmlHttpObj.responseText);
          if (INCLUDE_LOGIN_GDPR_ENCRYPT)
          {
              try{
                  $.newencryptorManager = $.encrypt.encryptManager;
                  $.Iencryptor =  $.newencryptorManager.getEncryptor();
              }
              catch(e)
              {
              	
              }
  
              $.nn = nn;
              $.ee = ee;
              $.seq = seq;
  			$.Iencryptor.setSeq($.seq);
  			$.Iencryptor.setRSAKey($.nn, $.ee);
  	
          }
          else if(INCLUDE_SSL)
          {
              n = nn;
              e = ee;
          }
          else
          {
              s=ss;
          }
          us = userSetting;
          if (INCLUDE_USER_RESTRICTION) {
              as = adminSetting;
          }
          if (logoUrl != '') {
              $('#pc-top-product').attr('href', logoUrl);
          }
      }
  
      function getBusy(callback) {
          var xmlHttpObj;
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  eval(xmlHttpObj.responseText);
                  callback.call(null, {
                      isLogined: isLogined,
                      isBusy: isBusy
                  });
  
              } else {
                  if (INCLUDE_USER_RESTRICTION) {
                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                  } else {
                      window.location.href = window.location.protocol + "//" + window.location.host;
                  }
              }
          });
  
          //bAsync must be set False to waiting entire response is received.
          xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getBusy", callback? true: false);
          xmlHttpObj.send(null);
  
          if (callback === undefined) {
              eval(xmlHttpObj.responseText);
              return {
                  isLogined: isLogined,
                  isBusy: isBusy
              }
          }
  
      }
  
      /*==================================
       *js for phone
       ====================================*/
      $('#pb-pc').on('click', function () {
          document.cookie = 'UserChange=true';
          isMF = 0;
          $('#viewport').attr('content', '');
          initPC();
      });
  
      $('#ph-setPwd-new, #ph-setPwd-confirm, #ph-login-user, #ph-login-password').on('focus', function () {
          $(this).removeClass('err').next('div.errDivP').hide();
      });
      /**
       * 给文本框显示或隐藏提示
       * @param obj {jQuery} input
       * @param text {string/boolean} 为字符串是显示提示，等于false时隐藏提示
       * @param isMobile {boolean} true表示手机
       */
      function inputError(obj, text, isMobile) {
          if (text === false) {
              if (isMobile) {
                  $(obj).removeClass('err').next('div.errDivP').hide();
              } else {
                  $(obj).tpInput('hideError');
              }
          } else {
              if (isMobile === true) {
                  $(obj).addClass('err').next('div.errDivP').show().find('.errTextP').html(text);
              } else {
                  $(obj).tpInput('showError', text);
              }
          }
  
      }
  
      $('#pb-phone').on('click', function () {
          $.deleteCookie("UserChange");
      });
  
      /*============================================
       *init
       ==============================================*/
      if (document.getElementById("mainBody") != null) {
          (function(domain, port, frame, page) {
              if ($.local) {
                  location.reload(true);
              } else {
                  var ret = window.parent.location.href.match(/(https?):\/\/([^:\/]+)(:\d+)?\/?([^?]*)/);
                  window.parent.location.href = ret[1] + "://" + (domain ? domain : ret[2]) + (port ? ":" + port : (ret[3] ? ret[3] : "")) + "/" + (frame ? frame : (ret[4] ? ret[4] : "")) + (page ? "#__" + page.match(/\w+\.htm$/) : "");
              }
          })();
      }
  
      /*==========================================
       * code for setPwd
       ==========================================*/
      var pwdCheckOK = false;
      $('#pc-setPwd-btn').on('click', function () {
          setPwdSubmit();
      });
      $("#pc-setPwd-new").on('keyup', function () {
          checkPwd();
      });
  	
  	
  	function checkNewPassword(){
  		var password = $("#pc-setPwd-new").prop('value');
  
  		if(password.length == 0)
  		{
  			return false;
  		}
  		if((password.length > 32) || (password.length < 6))
  		{
  			$('#t_passLen').removeClass("nd");
  			return false;
  		}
  		if (password.indexOf(" ") != -1) {
  			$('#t_haveSpace').removeClass('nd');
  			return  false;
  		}
  		if(/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]/.test(password) == false)
  		{
  			$('#t_passType').removeClass('nd');
  			return false;
  		}
  		return true;
  	}
  
      function pcCheckNewPassword()
      { 
          var password = $("#pc-setPwd-new").prop('value'); 
          var err = false; 
          if((password.length > 32) || (password.length < 6))
          { 
              $('#t_passLen').removeClass("nd"); 
              err = true; 
          }
          if (password.indexOf(" ") != -1) 
          { 
              $('#t_haveSpace').removeClass('nd'); 
              err = true; 
          }
          if(/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]/.test(password) == false) 
          { 
              $('#t_passType').removeClass('nd'); 
              err = true; 
          }
          if(err == true) 
              $('#pc-setPwd-new').tpInput('showError',""); 
      }
      function showNewPasswordProblem()
      { 
          var password = $("#pc-setPwd-new").prop('value');
          $('#t_passLen').removeClass("nd"); 
          $('#t_haveSpace').removeClass('nd');
          $('#t_passType').removeClass('nd');
          if((password.length > 32) || (password.length < 6))
          { 
              $('#t_passLen').css("color","red");
          }
          else{ 
              $('#t_passLen').css("color","green"); 
          }
          if (password.indexOf(" ") != -1) 
          { 
              $('#t_haveSpace').css("color","red"); 
          }
          else
          { 
              $('#t_haveSpace').css("color","green"); 
          }
          if(/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]/.test(password) == false)
          { 
              $('#t_passType').css("color","red"); 
          }
          else
          { 
              $('#t_passType').css("color","green"); 
          }
          return true; 
      }
  
  
  	$('#pc-setPwd-new').focus(function () {
  
  		$('#t_pwMust2Type').html($.tpLang.s_str.pwMust2Type);
  		$('#t_pwMustNoSpace').html($.tpLang.s_str.pwMustNoSpace);
  		$('#t_pwMustLength').html($.tpLang.s_str.pwMustLength);
  		$('#t_passFormat').html($.tpLang.s_str.passwordFormat);
  		showNewPasswordProblem();
  		
  	});
  	
  	$('#pc-setPwd-new').blur(function () {
          $('#t_passType').addClass("nd");
          $('#t_haveSpace').addClass("nd");
          $('#t_passLen').addClass("nd");
  		pcCheckNewPassword();
  	});
  	
      $('#pc-setPwd-new').keyup(function ()
      { 
          showNewPasswordProblem(); 
      });
  
  //for setPwd phone
      $('#ph-setPwd-btn').on('click', function () {
          setPwdSubmit(true);
      });
  
  	$('#ph-setPwd-new').focus(function () {
  		$('#t_passType').addClass('nd');
  		$('#t_haveSpace').addClass('nd');
  		$('#t_passLen').addClass("nd");
  		$('#t_passFormat').removeClass("nd");
  	});
  	
  	$('#ph-setPwd-new').blur(function () {
  		$('#t_passFormat').addClass("nd");
  		checkNewPassword();
  	});
  	
      function doSetPassword(pwd,callback) {
          var xmlHttpObj;
  
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  if (INCLUDE_USER_RESTRICTION) {
                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                  } else {
                      window.location.href = window.location.protocol + "//" + window.location.host;
                  }
              } else {
                  return;
              }
          });
          if (!INCLUDE_LOGIN_USERNAME && INCLUDE_USER_RESTRICTION) {
              var user = adminType == "admin" ? 'admin' : 'user';
              var preUser = encodeURIComponent($.Base64Encoding(user));
              var prePwd = encodeURIComponent($.Base64Encoding(pwd));
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/setPwd?pwd=" + prePwd + "&UserName=" + preUser, true);
  
          } else {
              var prePwd = encodeURIComponent($.Base64Encoding(pwd));
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/setPwd?pwd=" + prePwd, true);
          }
   		xmlHttpObj.send(null);
  
          //if(callback)
          //{
          //    callback();  
          //}
  
          
      }
  
      var setPwdSubmit = function (isMobile) {
          var $password = $("#pc-setPwd-new");
          var $confirm = $("#pc-setPwd-confirm");
          var value = $password.val();
          var confirmValue = $confirm.val();
          if (isMobile === true) {
              $password = $("#ph-setPwd-new");
              $confirm = $("#ph-setPwd-confirm");
              value = $password.val();
              confirmValue = $confirm.val();
          }	
  		
  		getAuthParm();
  		
  		if (INCLUDE_USER_RESTRICTION) {
  			if (adminType == "admin") {
  				us = as;
  			} else if (adminType == "user") {
  				us = us;
  			}
  			
  			switch (us) {
  			case 0:
  			case 3:
  				break;
  			default:
  				alert(e_str[ERR_USER_PWD_RESET_REPEAT]);
  				setTimeout(function() {
  					initLogin();
  				}, 300);	
  				return;
  			}
  		}
  
  		if(value.length == 0)
  		{
  			return alert(e_str[CMM_USER_PWD_FORMAT_ERR]);
  		}
  		if((value.length > 32) || (value.length < 6))
  		{
  			return inputError($confirm, e_str[CMM_USER_PWD_FORMAT_ERR], isMobile);
  			//return alert(e_str[CMM_USER_PWD_FORMAT_ERR]);
  		}
  		if (value.indexOf(" ") != -1) {
  		
  			return inputError($confirm, e_str[CMM_USER_PWD_FORMAT_ERR], isMobile);
  		}
  		if(/(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]/.test(value) == false)
  		{
  			return inputError($confirm, e_str[CMM_USER_PWD_FORMAT_ERR], isMobile);
  		}
  
          if (confirmValue != value) {
              inputError($confirm, $.tpLang.login.tipsTextConfirm, isMobile);
              return;
          }
  		
          if(isMobile != true)
          {
              doSetPassword(value, function() {
                  //do login after set password
                  var action = "1";
                  var isMobile = false;
                  var user = "user";
  
                  getAuthParm();
                  
                  if(INCLUDE_LOGIN_GDPR_ENCRYPT) {
  
                      if (!INCLUDE_LOGIN_USERNAME && INCLUDE_USER_RESTRICTION) {
                          user = adminType == "admin" ? 'admin' : 'user';
                      }
  
                      $.Iencryptor.setSeq($.seq);
                      $.Iencryptor.setRSAKey($.nn, $.ee);
                      $.Iencryptor.setHash(user, value);
                      $.Iencryptor.genAESKey();
  
                      user = $.Base64Encoding(user);
                      doLogin(user, value, action, isMobile, (isMobile ? $('#ph-login-btn') : $('#pc-login-btn')));
  
                  } else {
                      auth = rsaEncrypt($.Base64Encoding(value), n, e);
                      if (INCLUDE_LOGIN_USERNAME) {
                          name = rsaEncrypt($.Base64Encoding(user), n, e);
                      } else {
                          name = rsaEncrypt($.Base64Encoding('admin'), n, e);
                      }
                      doLogin(name, auth, action, isMobile, (isMobile ? $('#ph-login-btn') : $('#pc-login-btn')));
                  }
              });
          }
          
      };
  
      function checkPwd(isMobile) {
          var $password = $("#pc-setPwd-new");
          var $pwdCheck = $('#pwdCheck');
          var value = $password.val();
  
          if (isMobile === true) {
              $password = $("#ph-setPwd-new");
              $pwdCheck = $('#passwordLevelP');
              value = $password.val();
          }
  
          var asciiWithoutSpace = /^(?=[^ ]+$)[\x21-\x7f]+$/;
          var upperRe = /[A-Z]/;
          var lowerRe = /[a-z]/;
          var otherRe = /(.[^a-zA-Z0-9])/;
          var digitRe = /\d/;
  
          var hasUpper = 0;
          var hasLower = 0;
          var hasDigit = 0;
          var hasOther = 0;
          var largeLength = 0;
  
          var level = 0;
  
          if (asciiWithoutSpace.test(value) === false) {
              $pwdCheck.removeClass('level1 level2 level3');
              if (value == '') {
                  inputError($password, $.tpLang.login.tipsText, isMobile);
              } else {
                  inputError($password, $.tpLang.login.tipsTextAscii, isMobile);
              }
              pwdCheckOK = false;
              return;
          } else {
              inputError($password, false, isMobile);
              if (upperRe.test(value)) {
                  hasUpper = 1;
              } else {
                  hasUpper = 0;
              }
  
              if (lowerRe.test(value)) {
                  hasLower = 1;
              } else {
                  hasLower = 0;
              }
  
              if (digitRe.test(value)) {
                  hasDigit = 1;
              } else {
                  hasDigit = 0;
              }
  
              if (otherRe.test(value)) {
                  hasOther = 1;
              } else {
                  hasOther = 0;
              }
  
              if (value.length > 10) {
                  largeLength = 1;
              } else {
                  largeLength = 0;
              }
  
              level = hasUpper + hasLower + hasDigit + hasOther;
              if (level >= 2) {
                  level += largeLength;
              }
              if (level <= 1 || value.length <=5) {
                  $pwdCheck.removeClass('level2 level3').addClass('level1');
              } else if (level == 2 || level == 3) {
                  $pwdCheck.removeClass('level1 level3').addClass('level2');
              } else if (level >= 4) {
                  $pwdCheck.removeClass('level2 level1').addClass('level3');
              }
              pwdCheckOK = true;
          }
      }
  
      function initSetPwd(isMobile) {
          $('#pc-login').addClass('nd');
          $('#pc-cloud').addClass('nd');
          $('#pc-setPwd').removeClass('nd');
  
          buttonError($('#pc-setPwd-btn'), "<span class='red'>" + $.tpLang.login.notePart1 + ":</span> <br />" + $.tpLang.login.notePart2);
          //phone
          $('#ph-setPwd').removeClass('nd');
          $('#ph-login').addClass('nd');
          $('#ph-setPwd-note').show().find('.errTextP').html("<span class='red'>" + $.tpLang.login.notePart1 + ":</span> <br />" + $.tpLang.login.notePart2);
  
      }
  
      /*==========================================
       * code for login
       ==========================================*/
      $('#pc-login-password').on('focus', function () {
          if($(this).val() === '') {
              $(this).attr('placeholder', '');
          }
          if (INCLUDE_LOGIN_USERNAME && $('#pc-login-user').val() == '') {
              inputError($('#pc-login-user'), $.tpLang.login.tipsText);
          }
      });
      $('#pc-login-password').blur(function() {
          if($(this).val() === '') {
              $(this).attr('placeholder', $.tpLang.login.password);
          }
      })
      $('#pc-login-password').next('input').on('focus', function () {
          if($(this).val() === '') {
              $(this).attr('placeholder', '');
          }
          if (INCLUDE_LOGIN_USERNAME && $('#pc-login-user').val() == '') {
              inputError($('#pc-login-user'), $.tpLang.login.tipsText);
          }
      });
      $('#pc-login-password').next('input').blur(function() {
          if($(this).val() === '') {
              $(this).attr('placeholder', $.tpLang.login.password);
          }
      })
      function tpAlert(str, ok, no, replaceStr, okStr) {
          $('#mask').show();
          var container = $('#alert-container');
          if (isMF) {
              container.addClass('ph');
          } else {
              container.removeClass('ph');
          }
          container.show()
                  .find('.grid-warning-msg span.text').html(str);
  		$('#confirm-no').addClass('nd');
          $('#alert-container .msg-close').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (no) {
                  no();
              }
          });
          $('#confirm-yes').html('<span>' + (okStr || $.tpLang.m_str.ok) + '</span>').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (ok) {
                  ok();
              }
          });
      };
      $('#pc-login-btn').on('click', function () {
  		verify();
  
  		setTimeout(function(){
  
          if (isVerified == false) {
  
              $('#pc-login-vcode').focus();
  
  			alert("The input of verification is error, please check and input again!");
  			PCSubWin(isMF);
  
              return;
  
          }
  
          loginSubmit();},500);
      });
  
  //for phone
      $('#ph-login-password').on('focus', function () {
          if (INCLUDE_LOGIN_USERNAME && $('#ph-login-user').val() == '') {
              inputError($('#pc-login-user'), $.tpLang.login.tipsText, true);
          }
      });
  
      $('#ph-login-btn').on('click', function () {
          loginSubmit(true);
      });
  
      function showWelcome() {
          $('#welcome').removeClass('nd');
          $('#ph-div').addClass('nd');
          var icons = ['usb', 'wireless', 'internet', 'guest', 'device', 'phone'];
          for (var i = 0; i < icons.length; i++) {
              (function() {
                  var id = 'wel-'+icons[i];
                  var name = icons[i]+'-show';
                  setTimeout(function() {
                      $('#' + id).addClass(name);
                  }, 100*(i+1));
              })();
          }
          setTimeout(function() {
              $('#wel-logo').addClass('logo-show');
          }, 1500);
          setTimeout(function() {
              showLoginMobile();
          }, 3500);
      }
  
      function showLoginMobile() {
          $('#welcome').addClass('nd');
          $('#ph-div').removeClass('nd');
      }
  
      function initLogin(isMobile) {
          $('#pc-div').removeClass('nd');
          if (isCloudBind){
              $('#pc-login').addClass('nd');
              $('#pc-cloud').removeClass('nd');
          } else {
              $('#pc-login').removeClass('nd');
              $('#pc-cloud').addClass('nd');
          }
          $('#pc-setPwd').addClass('nd');
  
          $('#ph-login').removeClass('nd');
          $('#ph-setPwd').addClass('nd');
  
          //开机动画
          if (isMobile == true && authTimes == 0) {
              showWelcome();
          } else {
              showLoginMobile();
          }
  
          if (INCLUDE_LOGIN_USERNAME) {
              $('#pc-login-user-div').removeClass('nd');
              $('#ph-login-user-div').removeClass('nd');
          }
          if (authTimes > 0) {
              var text = $.tpLang.login.errorText;
              if (INCLUDE_LOGIN_USERNAME) {
                  text = $.tpLang.login.errorText2;
              }
              buttonError($('#pc-login-btn'), text);
              inputError($('#ph-login-password'), text, true);
              if (INCLUDE_LOGIN_USERNAME) {
                  $('#ph-login-password').removeClass('err');
              }
  
          }
          if (authTimes >= 5) {
              isLocked = true;
              lockWeb(true);
              var date = new Date();
              var time = date.getTime();
              var count = 60 - forbidTime;
              buttonError($('#pc-login-btn'), timesText.replace('$', count), true);
              inputError($('#ph-login-password'), timesText.replace('$', count), true);
              if (INCLUDE_LOGIN_USERNAME) {
                  $('#ph-login-password').removeClass('err');
              }
              setTimeout(function () {
                  if (count < 1) {
                      buttonError($('#pc-login-btn'), false);
                      inputError($('#ph-login-password'), false, true);
                      isLocked = false;
                      lockWeb(false);
                      if (INCLUDE_LOGIN_USERNAME) {
                          if (isMF) {
                              $('#ph-login-user').focus();
                          } else {
                              $('#pc-login-user').focus();
                          }
                      } else {
                          if (isMF) {
                              $('#ph-login-password').focus();
                          } else {
                              $('#pc-login-password').focus();
                          }
                      }
  
                      window.location.reload();
                      return;
                  }
                  date = new Date();
                  count = 60 - forbidTime - Math.round((date.getTime() - time) / 1000);
                  buttonError($('#pc-login-btn'), timesText.replace('$', count), true);
                  inputError($('#ph-login-password'), timesText.replace('$', count), true);
                  if (INCLUDE_LOGIN_USERNAME) {
                      $('#ph-login-password').removeClass('err');
                  }
                  window.setTimeout(arguments.callee, 1000);
              }, 1000);
          } else {
              if (INCLUDE_LOGIN_USERNAME) {
                  if (isMF) {
                      $('#ph-login-user').focus();
                  } else {
                      $('#pc-login-user').focus();
                  }
              } else {
                  if (isMF) {
  //                    $('#ph-login-password').focus();
                  } else {
                      $('#pc-login-password').focus();
                  }
              }
          }
      }
  
      var loginSubmit = function (isMobile) {
          if (isLocked == true) {
              return;
          }
  
          var auth;
          var name;
          var action = "1";
          var $password = $("#pc-login-password");
          var $user = $("#pc-login-user");
  
          getAuthParm();
  
          if (isMobile === true) {
              $password = $("#ph-login-password");
              $user = $("#ph-login-user");
          }
  
          var pwd = $password.val();
          var user = $user.val();
  
          if (INCLUDE_LOGIN_USERNAME && user == '') {
              inputError($user, $.tpLang.login.tipsText, isMobile);
              return;
          }
          if (pwd == "") {
              inputError($password, $.tpLang.login.tipsText, isMobile);
              return;
          }
  	
          if(INCLUDE_LOGIN_GDPR_ENCRYPT)
          {
              if (!INCLUDE_LOGIN_USERNAME && INCLUDE_USER_RESTRICTION) {
                  user = adminType == "admin" ? 'admin' : 'user';
              }
              $.Iencryptor.setSeq($.seq);
              $.Iencryptor.setRSAKey($.nn, $.ee);
              $.Iencryptor.setHash(user, pwd);
              $.Iencryptor.genAESKey();
  
              user = $.Base64Encoding(user);
              doLogin(user, pwd, action, isMobile, (isMobile ? $('#ph-login-btn') : $('#pc-login-btn')));
  
          } else {
              auth = rsaEncrypt($.Base64Encoding(pwd), n, e);
              if (INCLUDE_LOGIN_USERNAME) {
                  name = rsaEncrypt($.Base64Encoding(user), n, e);
              } else {
                  name = rsaEncrypt($.Base64Encoding('admin'), n, e);
              }
  
              if (isMobile) {
                  action = 3;
              }
  
              doLogin(name, auth, action, isMobile, (isMobile ? $('#ph-login-btn') : $('#pc-login-btn')));
  
          }
      };
  
      /**
       * 普通登录，云登录，手机登录共用的接口
       * @param name {string} 用户名
       * @param auth {string} 密码
       * @param action {number} 操作，这里只会出现1:普通登录和云登录，3:手机登录
       * @param isMobile {boolean} 手机UI标志位，用于addLoading
       * @param btn {jQuery object} 当前登录的牛，用于addLoading
       */
      function doLogin(name, auth, action, isMobile, btn,userInfo) {
  
  
          var xmlHttpObj = getHttpObject(function () {
              if (!isMobile) {
                  $.removeLoading();
              }
              if (INCLUDE_USER_RESTRICTION) {
                  window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
              } else {
                  window.location.href = window.location.protocol + "//" + window.location.host;
              }
          });
          if (INCLUDE_LOGIN_GDPR_ENCRYPT)
          {
              var tmpcount = {};
              tmpcount.UserName=name;
              tmpcount.Passwd=$.Base64Encoding(auth);
  			if(userInfo!=undefined)
  			{
  				tmpcount.cloudUserName=$.Base64Encoding(userInfo.username);
  				tmpcount.Token=userInfo.token;
  				tmpcount.LoginStatus="0";
  			}
  			tmpcount.Action = action;
              tmpcount.stack="0,0,0,0,0,0";
              tmpcount.pstack="0,0,0,0,0,0";
          }
          else{
  
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/login?UserName=" + name + "&Passwd=" + auth + "&Action=" + action + "&LoginStatus=0", true);
          }
          getBusy(function(status) {
              if (status.isLogined == 0) {
                  //没人登录则直接登录
                  if (!isMobile) {
                      $.addLoading(btn);
                  } else {
                      $.showCover();
                  }
  
                  if (INCLUDE_LOGIN_GDPR_ENCRYPT)
                  {
                      $.dm.cgi({
                          oid: '/cgi/login',
                          data: tmpcount,
                          callback: {
                              success: function (data) {
                                  $.rebootRemoveLoading();
                                  $.newencryptorManager.recordEncryptor();
                                  if (INCLUDE_USER_RESTRICTION) {
                                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                  } else {
                                      window.location.href = window.location.protocol + "//" + window.location.host;
                                  }
                              },
                              fail: function (data) {
                                  if (INCLUDE_USER_RESTRICTION) {
                                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                  } else {
                                      window.location.href = window.location.protocol + "//" + window.location.host;
                                  }
                              }
                          }
                      });
                  }
                  else
                  {
                      xmlHttpObj.send(null);
                  }
              } else {
                  //弹出提示说已经有人登录是不是要强制登录
                  tpConfirm($.tpLang.login.forceLogout, function () {
                      if (!isMobile) {
                          $.addLoading(btn);
                      } else {
                          $.showCover();
                      }
  
                      if (status.isBusy == 1) {
                          var delay = 1000;
                          var count = 0;
                          var timesTotal = 2;
                          var ask = function() {
                              getBusy(function(satus) {
                                  if (status.isBusy == 0 || count >= timesTotal) {
                                      //空闲或轮询次数到达最大次数就直接登录
                                      if (INCLUDE_LOGIN_GDPR_ENCRYPT)
                                      {
                                          $.dm.cgi({
                                              oid: '/cgi/login',
                                              data: tmpcount,
                                              callback: {
                                                  success: function (data) {
                                                      $.rebootRemoveLoading();
                                                      $.newencryptorManager.recordEncryptor();
                                                      if (INCLUDE_USER_RESTRICTION) {
                                                          window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                                      } else {
                                                          window.location.href = window.location.protocol + "//" + window.location.host;
                                                      }
                                                  },
                                                  fail: function (data) {
                                                      if (INCLUDE_USER_RESTRICTION) {
                                                          window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                                      } else {
                                                          window.location.href = window.location.protocol + "//" + window.location.host;
                                                      }
                                                  }
                                              }
                                          });
                                      }
                                      else
                                      {
                                          xmlHttpObj.send(null);
                                      }
                                  } else {
                                      count++;
                                      //轮询次数未到最大次数，进入递归
                                      setTimeout(ask, delay);
                                  }
                              });
                          };
                          setTimeout(ask, delay);
                      } else {
                          if (INCLUDE_LOGIN_GDPR_ENCRYPT)
                          {
                              $.dm.cgi({
                                  oid: '/cgi/login',
                                  data: tmpcount,
                                  callback: {
                                      success: function (data) {
                                          $.rebootRemoveLoading();
                                          $.newencryptorManager.recordEncryptor();	
                                          if (INCLUDE_USER_RESTRICTION) {
                                              window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                          } else {
                                              window.location.href = window.location.protocol + "//" + window.location.host;
                                          }
                                      },
                                      fail: function (data) {
                                          if (INCLUDE_USER_RESTRICTION) {
                                              window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                                          } else {
                                              window.location.href = window.location.protocol + "//" + window.location.host;
                                          }
                                      }
                                  }
                              });
                          }
                          else
                          {
                              xmlHttpObj.send(null);
                          }
                      }
                  }, function () {
                      if (!isMobile) {
                          //$.removeLoading();
                      }
                  }, null, $.tpLang.login.login, $.tpLang.m_str.cancel);
              }
          });
      }
  
      /**
       * 确认框
       * @param str {string} 提示文本
       * @param ok {function} 确认回调
       * @param no {function} 取消回调
       * @param replaceStr {string} 保留未用
       * @param okStr {string} 确认按钮的文本
       * @param cancelStr {string} 取消按钮的文本
       */
      function tpConfirm(str, ok, no, replaceStr, okStr, cancelStr) {
          $('#mask').show();
          var container = $('#alert-container');
          if (isMF) {
              container.addClass('ph');
          } else {
              container.removeClass('ph');
          }
          container.show()
                  .find('.grid-warning-msg span.text').html(str);
          $('#confirm-no').html('<span>' + (cancelStr || $.tpLang.m_str.cancel) + '</span>').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (no) {
                  no();
              }
          });
  
          $('#alert-container .msg-close').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (no) {
                  no();
              }
          });
          $('#confirm-yes').html('<span>' + (okStr || $.tpLang.m_str.ok) + '</span>').off('click').on('click', function () {
              $('#alert-container').hide();
              $('#mask').hide();
              if (ok) {
                  ok();
              }
          });
  
      }
  	
  	function getEwebUrl(module) {
          var xmlHttpObj;
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  return;
  
              } else {
                  if (INCLUDE_USER_RESTRICTION) {
                      window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname;
                  } else {
                      window.location.href = window.location.protocol + "//" + window.location.host;
                  }
              }
          });
  	
          //bAsync must be set False to waiting entire response is received.
          xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getEwebUrl", false);
          xmlHttpObj.send(null);
          eval(xmlHttpObj.responseText);
          $.cloudOrigin = EwebURL;
          if(!$.cloudOrigin){
              $(window).trigger("ev_watingTimeout");
          }else{
             $.setIframeSrc(module, true);
          }
      }
  
      /*==========================================
       * code for pc cloud
       ==========================================*/
      var token;
  	
      $('#cloud-bind-btn').on('click', function () {
          cloudSubmit();
      });
      $('#pc-cloud-btn').on('click', function () {
          cloudSubmit();
      });
      $('#pc-cloud-user').tpInput({
          placeholder: $.tpLang.login.email
      });
      $('#pc-cloud-password').on('focus', function () {
          if ($('#pc-cloud-user').val() == '') {
              inputError($('#pc-cloud-user'), $.tpLang.login.tipsText);
          }
      }).tpInput({
          placeholder: $.tpLang.login.password
      });
  
      $('#pc-cloud-forgetPwd').html($.tpLang.login.forgetPwd).on("click", function (e) {
          e.preventDefault();
          onReceive({data: {eType: "ev_goto", url: "findBackPassword"}, source: null, origin: "_self"});
      });
  
  	// switch local login and cloud login part
      if (INCLUDE_CLOUD) {
          var loginSwitchBtn = $("<div class=\"login-switch-btn\"><span>" + $.tpLang.login.LOGIN_WITH_TPLINK_ID + "</span></div><div class=\"login-switch-note nd\">"+$.tpLang.login.LOGIN_SWITCH_NOTE+"</div>");
          $('#pc-login-submit').append(loginSwitchBtn);
      }
  	
  	$("span#login-bind-note").html($.tpLang.login.BIND_NOTE);
  	$("#bound-error .note").text($.tpLang.login.BOUND_ERROR_NOTE);
  	$("#bound-error .switch-btn").text($.tpLang.login.LOGIN_WITH_ROUTER_PASSWORD);
  	$("#bound-error .switch-btn").click(function(){
  		$("#bound-error").hide();
  		initLogin(isPhoneUI);
  	});
  	
      $('.login-switch-btn').on("click", function (e) {
          if (isLocked == true) {
              return;
          }
          $.addLoading();
  		if ($.nn==undefined){
              getAuthParm();
          }
  		isCloudBind = false;
          $.checkCloudConn(function(){
              initCloud();
                  e.preventDefault();
                  $(".login-switch-note").hide();
                  onReceive({data: {eType: "ev_goto", url: "login"}, source: null, origin: "_self"});
                  $.rebootRemoveLoading();
              }, function(){
                  $(".login-switch-note").show();
                  $.rebootRemoveLoading();
          });
      });
  	
      function getBindStatus(username,token) {
          var xmlHttpObj;
          xmlHttpObj = getHttpObject(function () {
              if (xmlHttpObj.status == 200) {
                  return;
  
              } else {
                  window.location.href= window.location.protocol + "//" + window.location.host;
              }
          });
          //bAsync must be set False to waiting entire response is received.
          if(INCLUDE_LOGIN_GDPR_ENCRYPT) {
              var info;
              var str = username+"&"+token;
              $.Iencryptor.setHash(username, token);
              $.Iencryptor.genAESKey();
              info = $.Iencryptor.AESEncrypt(str, 1);
              $.newencryptorManager.recordEncryptor();
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getBindStatus?data=" + encodeURIComponent(info.data) +"&sign=" + info.sign, false);
          } else {
              xmlHttpObj.open("POST", window.location.protocol + "//" + window.location.host + "/cgi/getBindStatus?cloudUserName="+$.Base64Encoding(username)+"&Token="+token, false);
          }
          xmlHttpObj.send(null);
        
services.body_hash_sha1: sha1:5733dd5403a8b9c98f1cb708161451ceb5148665
services.supported_versions: HTTP/1.1
services.protocol: CWMP
services.transport_protocol: TCP
services.scan_time: 2025-07-27T18:52:54.633739
services.server: tr069 http server
[binary data, 10 values, 272 bytes]