如何在YII Web应用程序前创建Android类型锁定屏幕

时间:2012-06-09 14:04:46

标签: php jquery yii

提前感谢任何建议。

我是很长时间的开发人员,但在网络方面很新,所以请原谅任何无知。

我正在尝试创建一个Android类型的锁定屏幕(您可以按正确的顺序将鼠标移动到块上以创建密码)。在此之后,它将显示我的yii应用程序的登录页面。

这将是我们在客户位置安装的盒子来管理我们的东西。所以客户端只能访问http网页 - 不用担心密码嗅探等。

我有一个锁定屏幕的模型,我有一个基本的yii应用程序,如果未经过身份验证,则默认为登录屏幕。我假设我需要合并我的模型和登录页面。如果用户即使在登录屏幕上进行了身份验证,也不会显示我的锁定屏幕。

问题:

  1. 如何将锁定屏幕密码安全地传递给后端 身份验证(我在按钮点击时想的是POST方法)
  2. 如何在进行身份验证时隐藏锁定屏幕(在yii / php中确定是否使用了身份验证)
  3. 优雅地接受任何更好的想法:-) 3。
  4. 编辑如果用户输入密码错误,还想重置,您认为另一个按钮/左键点击网格是什么?

    假设使用yiic创建了示例登录页面。

    我的示例锁定屏幕

    <!DOCTYPE html>
    <html>
    <head>
       <title></title>
       <style type="text/css">
    
    .untouched {
       background: green;
    }
    
    .touched {
       background: blue;
    }
    
    .button {
       padding: 12px;
       height: 100px;
       width: 100px;
    }
       </style>
       <script src="/jquery.js"></script>
    </head>
    <body>
       <table>
          <tr>
             <td id="1" class="button untouched"></td>
             <td id="2" class="button untouched"></td>
             <td id="3" class="button untouched"></td>
             <td id="4" class="button untouched"></td>
          </tr>
          <tr>
             <td id="5" class="button untouched"></td>
             <td id="6" class="button untouched"></td>
             <td id="7" class="button untouched"></td>
             <td id="8" class="button untouched"></td>
          </tr>
          <tr>
             <td id="9" class="button untouched"></td>
             <td id="10" class="button untouched"></td>
             <td id="11" class="button untouched"></td>
             <td id="12" class="button untouched"></td>
          </tr>
          <tr>
             <td id="13" class="button untouched"></td>
             <td id="14" class="button untouched"></td>
             <td id="15" class="button untouched"></td>
             <td id="16" class="button untouched"></td>
          </tr>
       </table>
       <h1 id="password"></h1>
       <script>
          $(document).ready(function(){
          });
    
          $(".untouched").mouseenter(function(){
             if($(this).hasClass("untouched"))
             {
                $("#password").text($("#password").text() + ' ' + $(this).attr("id"));
             }
             $(this).removeClass("untouched").addClass("touched");
          });
       </script>
    </body>
    </html>
    

1 个答案:

答案 0 :(得分:0)

  1. POST方法是对用户进行身份验证的正确方法,从不考虑GET,因为任何人都可以看到用户名和密码。
  2. 您可以使用javascript在localStorage(首选)或Cookie中保存会话ID或类似内容,以了解用户是否通过AJAX验证并访问页面API,当API抛出错误时使用标头{{ 1}},让你的应用再次提示登录页面。
  3. 如果您的应用需要与服务器互动,您可以了解基于OAuth的应用是如何运作的。
  4. Live Fiddle Example